Application Note of BM88 Module
|2015-7-23||V0.2||Add test mode|
|2015-08-03||V0.3||Add configurable mode and drop link feature|
|2015-08-07||V0.4||Add bard rate|
|2015-08-10||V0.5||Add passward set|
|2015-08-20||V0.6||It is in AT command mode when BM88 is not linked, it is raw data transfer mode when BM88 is linked.
Add support sleep mode for BM88, default it will enter deep sleep mode after 10s no data transfer. If it enter sleep mode ,BM88 can be wakeup by uart.2015-08-24V0.7Add AT command to config the ble UUID mode.
AT#U11 uuid mode 1
AT#U12 uuid mode 22015-08-25V0.8Add ble authentication rand&ediv management。
Add firmware version manage, and AT command to get firmware version.2015-08-31V0.9Add discoverable set, get mac address, set ibeacon info2015-09-02V1.0Add gpio to indicate the bm88 start normally;
Add gpio to indicate that the bm88 is accessed by phone, other phone can’t connect it;
Remove the Tx indicate of PA4.modify it indicate connection.
This document describes how to use BM88 to setup a Bluetooth connection and how configure the BM88 and how to send data by BM88.
BM88 can detect the standard SPP and BLE devices and auto switch between these two different devices.
1.1. BT Mode Definition
1. Standby Mode: BM88 is under Bluetooth discoverable and connectable mode. It can also be paired by another device in this mode.
Classic Bluetooth (BR/EDR): Enable the Inquiry Scan and Page Scan in this Mode.
Bluetooth Low Energy: Enable the Undirected Advertising in this Mode.
2. Linked Mode: Bluetooth connection is established successfully
Classic Bluetooth (BR/EDR): BM88 will use SPP protocol to exchange the application data.
Bluetooth Low Energy: BM88 will use GATT protocol to exchange the application data.
1.2. BM88 State Definition
- At command state: BM88 is in AT command state when no connection and not deep sleep mode.
- Access State: BM88 is setting up Bluetooth Connection(PA4 is L).
- Linked State: BM88 is ready to exchange Host MCU UART traffic(PA3/PA4 is L/L).
Lower Power State: If no data transfer or no connection for more than 10s, BM88 will enter lower power mode(bm88 has three lower power mode: deep sleep, sleep mode(default), mix sleep mode). In all Lower Power state, BM88 can be wakeup by phone send data or by phone try to set up connection.
deep sleep mode:
This mode will get lowest power, when PA4 is L, if Host MCU want to send data, need pull down the WAKEUP pin first to wakup BM88. After BM88 started up, it is in fast advertising first, in this state, bm88 will not enter lower power state, after 30s, it is enter slow advertising, in this state, if more than 10s has no connection, bm88 will enter Lower Power State. If PA3/PA4 is H/H, mean BM88 is in standby and deep sleep State. If PA3/PA4 is H/L, mean BM88 is in linked and deep seep State.
In this mode, bm88 can be wake up by uart data, but the power is larger 6mA than deep sleep mode.
Mix sleep mode :
In this mode, if bm88 enters Lower power state in Standby mode, it will enter deep sleep mode. If is in linked state, it will enter sleep mode. Use this sleep mode, can be save a pin(no need wakeup pin).
Which mode to save power, can be set by AT command.
1.3. Bluetooth Power on Flow
2. Function Description
2.1. Supported Bluetooth Profiles
- Alternative Bluetooth v3.0+EDR and Bluetooth v4.0 Low Energy supported
- Embedded Bluetooth stack profiles included
- BTv3.0: GAP, SPP, SDP, RFCOMM and L2CAP. BM88 is as slave role.
- BTv4.0: GAP, GATT, ATT, SMP and L2CAP. BM88 is as peripheral and server.
- Support iOS CoreBluetooth connection.
- Configurable GAP (General Access Profile) to meet different link establish scenario.
2.2. UART transparent mode
UART supports baud rates from 1200 to 115200bits/s.
- UART Baud rate default setting: 115200
- UART setting: no Parity check, 8 bit, 1 stop bit, no flow control
Bluetooth Sniff mode and sleep mode supported.
Bluetooth Low Energy Connection parameters can be update by central. For BLE，central need update connection parameter to let the connection interval larger than 0x80(unit:1.25ms).
Signal of PA4 (connection_status_IND) and PA3(RX_state_IND) are required to guarantee tx/rx of UART data:
PA3: Hàhost MCU can’t send data to BM88
Làhost MCU can send data to BM88
PA4: HàBM88 has no connection
LàBM88 has connection
2.4. Utility features
2.4.1 BM88 State indication by PA3(RX_STATUS_IND) and PA4 (connection_STATUS_IND)
2.4.2 Wakeup BM88 from LowPower State by WAKEUP low active control.
If BM88 is Link State before enter Low Power State, After Wakeup trigger, PA4/PA3 will become LL immediately, Host MCU can send data to BM88.
If BM88 is Access State before enter Low Power State, After Wakeup trigger, PA4/PA3 will become LH immediately, in this state, Host MCU can’t send data to BM88 until BM88 enter Linked State.
configurable mode active gpio:
PB1, input mode, L is active, default is H;
If PB1 is low, when BM88 power on, it will enter configurable mode, Host MCU can modify parameters by send AT command through uart. After all modify finished, to let the modify effect, need restart BM88.
Code: command identity;
Len: the value length,[0~9]
Value: command parameter
AT##0 à success
AT##[code:1byte][value] àresponse fixed length value
AT##[code:1byte][len:2byte/1byte][vaue] àresponse variable length value
Change the device name to BTCOM20, you can send AT#N7BTCOM20 to BM88 by uart, after receive AT##0, the name is changed success, it will effect when next power on BM88.
All AT Cmd list:
||The name is utf8 encoded||Change the Bluetooth device name to the new set one, the max length of name is 25 byte.||AT#N05MySpp
Nullget device nameSend： AT#L
Resp： AT##L[len][name in len]
len：The length of value. Two byte, in decimal.
AT##L06123456R0nullReset the all config param to the default. This will let delete all the settings, and all the paring info.AT#RBThe length of value. One byte, in decimal.115200、38400、19200、9600.
The value is in decimal。Can use this command to change the baud rate to which host MCU wanted;
The value is in decimal.AT#B519200
AT#B49600O0NullGet the passwordSend： AT#O
Resp： AT##O[len][password in len]
len: 1 byte, the length of password
password: in len
AT##O41234PThe length of value. One byte,
Supported length is 4 or 6.Password in decimal
default there is no PIN pair, it is in simple pair mode.Can make BM88 need mitm protect，the passward can be set dynamic。
If len is 0, will disable mitm protect.AT#P6123456
AT#P0 (disable password authentication,restore the simple pair mode)D0NullReset the BM88 for new AT command param. Can only used in AT command mode when not linked.
- one byte.
1: sleep mode
2:deep sleep mode
3:mixer sleep mode(enter deep sleep when bt not connected, enter sleep mode when bt is onnected)
Default is 1.Set the the sleep mode for BM88 when more than 10s has no data transfer.
If set to sleep mode ,the BM88 can be wakeup by uart; If set to deep sleep mode, the BM88 can be wake up by data send from client(for example:phone) and the wakeup pin, can’t be wakeup by uart.AT#S11:sleep mode
AT#S12:deep sleep mode
AT#S13:mixer sleep modeU
- one byte
2:mode 2Set the ble transfer profile uuid mode.
The uuid is defined in GATT Proprietary Service For Transparent DataAT#U11
AT#U12V0 Get the firmware version. If success, bm88 will send AT##V to host MCU, here  is the version code, for example: AT##V08, mean the version NO. is 0.8.Send:AT#V
Resp:AT##V08Aone byte0: disable Atcommand when not linked;
1:enable Atcommand when not linked;Whether enable the AT command mode when bt is not linked or not.
Default is enable the AT COMMAND mode when not linked.AT#A11 enable
AT#A10 disableM0 Get mac address.
Resp to the host MCU the MAC of the bt, the MAC is in big-endian.Send:AT#A
Resp:AT##A]Cone byte0:not discoverable
1:discoverableSet the BM88 is discoverable when standby.
Default is discoverableAT#C11 discoverable
AT#C10 undiscoverableITwo byteThe ibeacon info. Include: uuid,major, minor, tx power. All in big-endian.Set the beacon info.
Default the beacon is disable.
If the length is 0, will disable the beacon feature.AT#I21[raw data of beacon info: 16byte uuid in hex mode|major|minor|tx_power]
The beacon info,for example: B9 40 7F 30 F5 F8 46 6E AF F9 25 55 6B 57 FE 6D 00 05 00 08 C5
AT#I00, disable the beacon feature.YOne type0:not indicate
1:indicate the bm88 starts normally;In mode 1, If model is startup normally, will pull down the PB4(pin18);AT#Y10 PB4&PB3 will no feature
AT#Y11 PB4 has feature
The application in host MCU flow like this:
If BM88 is not linked, it is in AT command mode, if BM88 is linked, it is in raw data transfer mode;
When BM88 is started, the host MCU will receive the AT#START， after receive this，host MCU can send AT command like 2.4.3, until the PA3 is pull L。If PA3 is pull L, AT command send from host MCU will be as the raw data to be send to phone.
If host MCU want the parameter is valid immediately, after all parameter set AT command, send the AT#D command, the BM88 will automate to hot reset.
Host MCU also can pull down and pull up the LDO EN to let the parameter valid. How to do, it is decided by host MCU.
In this mode, All the at commands can be send by once, for example:
BM88 will send back:
Then the host MCU can wait the the BM88 linked.
The application in host MCU， flow like this：
2.4.5 link drop
Gpio PB2 used for link drop, default is H, L is active, if pull down more than 10ms, BM88 will disconnect all link, and enter standy mode.
2.5. GATT Proprietary Service For Transparent Data
UUID mode 1:
|49535343-1E4D-4BD9-BA61-23C647249616||Tx characteristic||notify||Send data from BM88 by Notify.|
|2902||Client configuration||Read/write||Configuration for enable/disable Notification .
Default is 0, the
App in phone need write this value to 1, before it can receive data from BM88.49535343-8841-43F4-A8D4-ECBE34729BB3Rx characteristicwritetransmit data to bm88 by writing this characteristic’s value
UUID mode 2
|0xfff1||Tx characteristic||notify||Send data from BM88 by Notify.|
|2902||Client configuration||Read/write||Configuration for enable/disable Notification .
Default is 0, the
App in phone need write this value to 1, before it can receive data from BM88.0xff2Rx characteristicwritetransmit data to bm88 by writing this characteristic’s value
2.6. BM88 pin description
BM88 link state indication
H Power On default state or Low Power State or no connection.
L Access state(BM88 is setting up connection)
BM88 rx enable indication.
if H， host MCU can’t send data to BM88;
if L, host MCU can send data to BM88;
If PA3 is H, Host MCU can’t send data to BM88, only when PA3 is L, Host MCU can send data to BM88 by uart;
If PA3/PA4 is H/L, Host MCU need pull down the WAKEUP pin, then until the PA3 is L, then host MCU can send data.
|WAKEUP||Falling is active, when PA3/PA4 is HL, Host MCU pull down this pin first any time it wants to use BM88 for raw data transparent.|
|BOOT0||Low is application mode;
High is update firmware mode;
BM88 can update firmware by pull up the BOOT0, enter update mode, then can update firmware by uart;PB4Pull down mean Bm88 has start up successful and the stack is init ok. Can use this pin to detect the BM88 is in ok state or not.PB3Reserved for future configuable use.PB2Link drop mode
L is more than 10ms active for disconnect all link, then force BM88 enter standy modePB1Config mode enable gpio
L is active for config modePA2With PA1,used for module test when product
L：BM88 enter test mode
H：BM88 enter application mode
Default: H Host MCU need let it HPA1Output gpio:
Success: pull H, then pull L after 10ms;
Fail: always H
Default: L There is no use to Host MCULDO_ENPulldown will shutdown the BM88, if want to save more power, can use LDO_EN to active and unactive the BM88 model.
Host MCU send data to BM88，one time can send 511 byte at maximum.
The phone send to BM88, if by BLE, the max length of one value is 256 byte;
Android API describes it as following:
If you want to use spp on Android phone, The application should be wroten like this: