Firmware/ZeroBeacon

From Wiki for April Brother
Jump to: navigation, search

Introduce

ZeroBeacon firmware provide the features Beacon + UART transparent transfer. It can be config with AT command.

Features

BLE Service UUID FFF0

  • Subscribe FFF1 to get RX data.
  • Write to FFF2 to send TX data.

AT Command & Configuration

AT commands can only be used when the BLE is not connected to any cellphone or other device.

AT Command for iBeacon

Command Summary Examples Response
AT+BCON? Query the iBeacon advertising status.
1:on 0:off
AT+BCON1
AT+BCON[param1] Set the iBeacon advertising on
1:turn on 0 turn :off
AT+BCON1 OK+Set:1
AT+PUID? Query the proximityUUID for iBeacon AT+PUIDE2C56DB5DFFB48D2B060D0F5A71096E0
AT+PUID[param1] Set the proximityUUID for iBeacon AT+PUIDE2C56DB5DFFB48D2B060D0F5A71096E0 OK+Set:E2C56DB5DFFB48D2B060D0F5A71096E0
AT+MAJR? Query the major for iBeacon AT+MAJR999
AT+MAJR[param1] Set the major for iBeacon AT+MAJR123 OK+Set:123
AT+MINR? Query the minor for iBeacon AT+MINR999
AT+MINR[param1] Set the minor for iBeacon AT+MINR123 OK+Set:123
AT+MPOW? Query the measured power for iBeacon OK+MPOW-59
AT+MPOW[param1] Set the measured power for iBeacon AT+MPOW-58 OK+Set:-58
AT+ADVI? Query the advertising interval. The unit is 100ms OK+ADVI1
AT+ADVI[param1] Set the advertising interval. The unit is 100ms AT+ADVI10 OK+Set:10
AT+POWR[param1] Set the TX power level.
0: 0dBm 1: 4dBm
2: -6dBm 3: -23dBm
AT+POWR1 OK+Set:1

Other Command

Command Summary Examples Response
AT+NAME? Query the device name OK+NAMEZeroBeacon
AT+NAME[param1] Set the device name AT+NAMEhello OK+Set:hello
AT Query the status OK
AT+VERS? Query the firmware version OK+VERS1.0
AT+ADDR? Query the native MAC address OK+LADD: MAC address (address for 12 string)
AT+BAUD[param1] Set the baud rate
param1 : 0 - 4.
0: 9600, 1: 19200
2: 38400, 3: 57600
4:115200
Default: 0 (9600)
AT+BAUD1 OK+Set:1
AT+RESET Reset the device

Commands for ZeroBeacon 2.0

Command Summary Examples Response
AT+ROLE? Query the central/peripheral role
The default role is peripheral.
1: peripheral
2: central
OK+ROLE0
AT+ROLE[param1] Set the role
After using the AT+ROLE command to change the role, you must then execute AT+RESET to put that change into effect
AT+ROLE1 OK+Set:1
AT+SCAN? Scan the peripheral nearby. Only works when the role is central
OK+SCAN1
OK+SCAN:0x123456789012
OK+SCAN0
AT+CONN[param1] Connect the peripheral. Only works when the role is central AT+CONN123456789012

Commands for ZeroBeacon 2.1

Command Summary Examples Response
AT+ROLE? Query the central/peripheral role
The default role is peripheral.
0: peripheral
1: central
OK+ROLE0
AT+SDUR[param1] Scan duration in seconds. run AT+RESET to activate the new duration timing AT+SDUR1 OK+Set:1
AT+SCAN0 Stop scan
OK+SCAN0
AT+SCAN1 Scan behavior like version 2.0
AT+SCAN2 Keep scan iBeacon and return ASCII format AT+SCAN2
OK+SCAN:0017EA915E24,E2C56DB5DFFB48D2B060D0F5A71096E0,1,8,-58,-72,100
OK+SCAN:C4EDBA567941,E2C56DB5DFFB48D2B060D0F5A71096E0,0,0,-58,-72
OK+SCAN:20CD3999087E,E2C56DB5DFFB48D2B060D0F5A71096E0,1,6,-65,-69,100
AT+SCAN3 Keep scan iBeacon and return HEX format AT+SCAN3 Start with OK+SCAN:, end with "\r\n"

Commands for ZeroBeacon 2.1.6

Command Summary Examples Response
AT+SCAN4 Scan BLE module and return raw advertsing data in hex format AT+SCAN4 OK+SCAN4, Start with OK+SCAN:, end with "\r\n"

Example response hex data for AT+SCAN4

Note: The serial function will not work if the device go to sleep. You need give high level to pin P0.1 to wakeup the device.

4f 4b 2b 53 43 41 4e 3a 12 3b 6a 1a 64 cf aa 03 1e 02 01 06 1a ff 4c 00 02 15 b5 b1 82 c7 ea b1 49 88 aa 99 b5 c1 51 70 08 d9 00 01 cf 64 c5 0d 0a

Bytes Description Example
1 - 8 bytes hex code for "OK+SCAN:" 4f 4b 2b 53 43 41 4e 3a
9 - 14 bytes mac address for BLE device 12 3b 6a 1a 64 cf
15 byte RSSI,minus 255 for real value aa
16 byte Advertising Type 03, see the table below
17 byte Data length for advertisement data 1e
18 byte - Advertisement data, see 17 byte for length 02 01 06 1a ff 4c 00 02 15 b5 b1 82 c7 ea b1 49 88 aa 99 b5 c1 51 70 08 d9 00 01 cf 64 c5
 ? End signal, hex code for "\r\n" 0d 0a

Commands for ZeroBeacon 2.2.1

Command Summary Examples Response
AT+PUID=[param1] Set the proximityUUID for iBeacon AT+PUID=E2C56DB5DFFB48D2B060D0F5A71096E0 OK+Set:E2C56DB5DFFB48D2B060D0F5A71096E0
AT+NAME=[param1] Set the device name AT+NAME=hello OK+Set:hello
AT+SLEEP make the BLE module go to sleep AT+SLEEP OK+SLEEP, It can't accept any at command now
AT+CONN? query connection status AT+CONN? OK+CONN:1 1 - connected 0 - disconnected
AT+RADD? query mac address of remote device AT+RADD? OK+RADD:0x1234567890AB
AT+RSSI? query RSSI of remote device, only affected when central connected AT+RSSI? OK+RSSI:-49
AT+SDUR? query scan duration AT+SDUR? OK+SDUR:1000
AT+POWR? query TX power AT+POWR? OK+POWR:-59

Commands for ZeroBeacon 2.2.3

Command Summary Examples Response
AT+PIN=[param1] Set pin code, the pin code should be 6 digits. The default pin code is 000000. Only affected when auth mode > 1 AT+PIN=123456 OK+Set:123456
AT+AUTH[param1] Set the auth mode
0: no auth and passcode needed, default mode
1: auth without passcode
2: auth with passcode
3: auth and bond
AT+AUTH1 OK+Set:1
AT+DBOND delete all devices bonded AT+DBOND OK+DBOND

Advertising Type Code

Code Description
0 Connectable undirected advertisement
1 Connectable directed advertisement
2 Scannable undirected advertisement
3 Non-Connectable undirected advertisement
4 Scan Response

ChangeLog

Version 2.2.3

  • A device in peripheral role will output OK+CONN if connected
  • Add command AT+AUTH to change the auth mode
  • Add command AT+PIN to enable pin code for auth
  • Add command AT+DBOND for devices bonded

Version 2.2.1

Notices

This version force add a "=" for AT setup command. For example:

Replace AT+PUIDE2C56DB5DFFB48D2B060D0F5A71096E0 with AT+PUID=E2C56DB5DFFB48D2B060D0F5A71096E0

But you can still use orginal AT setup command to setup digital value: AT+MINR1234

Changes and minor enhancements:

  • Upgrade the BLE stack to latest version
  • Add command AT+SLEEP for make the BLE module go to sleep. For wake it up, add a rising edge to P0.1
  • Add command AT+CONN? to query connection status
  • Add command AT+RADD? to query mac address of remote device when connected
  • Add command AT+RSSI? to query RSSI value after connected (central only, not work for peripheral yet)
  • Minor change for AT+SCAN1 output

Bug Fixes

  • Fix for crash by command AT+ADVI?
  • Fix for command AT can't disconnect when central role
  • Fix for peripheral can't send message to central when connected
  • Fix for central can't send message to peripheral after reconected
  • Fix for central can't get mac address

Version 2.1.7

  • The unit for AT+SDUR (scan duration) is changed from second to ms. For example: AT+SDUR300. the at command will change scan duration to 300ms.

Version 2.1

  • Response \r\n at the line end for AT commands
  • Fix a bug for configure iBeacon proximityUUID
  • Add AT commands for scan iBeacon

Related Products