Difference between revisions of "BLE Bee"

From ITEAD Wiki
Jump to: navigation, search
m (Overview)
m (Revision History)
Line 30: Line 30:
 
|-
 
|-
 
| V1.1||Add GPIO function;
 
| V1.1||Add GPIO function;
|-
+
 
| Add ADC function;
+
Add ADC function;
|-
+
 
| Add remote GPIO & ADC control.
+
Add remote GPIO & ADC control.
|-
+
 
| Add error messages’ instruction for users to check.||2015-06-19
+
Add error messages’ instruction for users to check.
 +
||2015-06-19
 
|}
 
|}
 
| align="center" style="background:#f0f0f0;"|'''Parameter'''
 
| align="center" style="background:#f0f0f0;"|'''Parameter'''

Revision as of 06:50, 7 July 2015

Overview

Im150611001 1.JPG

BLE Bee ITDB031 is a serial port BLE module. It is based on TI’s CC2541 BLE chip. With it you can transfer data wirelessly and do remote control. It supports both central mode and peripheral mode. And It supports remote control to the other side which is connected. Also it can a support custom commands when you combine it with other devices. The BLE Bee is compatible with XBee socket. You can just plug it onto the XBee socket.

Note: The serial interfaceis 3.3v, not the typical 5v as on many Arduino boards - anyone using an alternative to the Foca board must take note not to risk damage.

Specifications

Microprocessor CC2541
PCB size 24mm X 24mm X 1.6mm
Power supply 3.3V

Electrical Characteristics

Revision History

Rev. Description Release date
v1.0 Initial version 2015-06-11
V1.1 Add GPIO function;

Add ADC function;

Add remote GPIO & ADC control.

Add error messages’ instruction for users to check.

2015-06-19
Parameter Min. Typical Max. Unit Power voltage 3 - 3.3 VCC Input voltage VinH 3 3.3 3.3 V Input voltage VinL -0.3 0 0.5 V Current Consumption - - 15 mA

Hardware

IM150611001-1.png IM150611001-BLE Bee.png

Pinmap

Idex Name Pin of ITDB031 Name of ITDB031
1 3V3 P11 VCC_IN
2 TXD P7 P1_5
3 RXD P8 P1_4
4 DD P2 P2_1
5 RST P17 RESET
6 PWMO P4 P1_6
7 PWM1 P3 P1_7
8 SCL P5 SCL
9 NC - -
10 GND P12 GND
11 DC P1 P2_2
12 GTS P10 P1_2
13 NC - -
14 SDA P6 SDA
15 NC - -
16 RTS P9 P1_3
17 A5 P13 P0_5
18 A4 P14 P0_4
19 A3 15 P0_3
20 A2 P16 P0_2

Note:

  • The default uart interface is USART0’s P1_4(RX) and P1_5(TX).
  • The debug interface can be used to re-program the CC2541 chip.
  • Except uart, I2C and debug interface , other pins are default GPIO input.
  • Except uart and debug interface, other pins can not be used with current software.

Software

The current software supports central mode and peripheral mode. One ITDB031 can only be in one mode at one time. This can be switched by AT commands. Each ITDB031 has two names. One is peripheral name. This name is used for peripheral device to advertise, telling that who it is. And this name can be scanned by a central device before a connection starts. The other name is connecting name. This name is used to match the peripheral name, when one ITDB031 turns into central mode and starts a connection. This name is used by a central device, telling whom it will connect to. When the two names are matched, a connection can be build. At current time one central device can only connect one peripheral device. Similarly, each ITDB031 has two passcodes. One is peripheral passcode and the other is central passcode. A central device sends its central passcode to a peripheral device when the peripheral requests a connecting passcode. If the central passcode which a central sends matches the peripheral passcode which a peripheral has, the connection is build. Otherwise, the peripheral can terminate the connection.

At Commands

Factory default setting: Peripheral Name: Itead Central Name: Itead Peripheral passcode: 0 (means that no passcode needed) Uart: baudrate 9600, N, 8, 1, ADC reference: 0 (1.25V)

AT commands’ format: Each command with its parameter is a string. And every command must end with either '\r' or '\n'.

   Command's parameter starts with a '=' .

Command's return is also a string , which ends with '\0'. For example: AT\n or AT\r AT+DATA=1\n or AT+DATA=0\r

AT commands’ mode: AT MODE: Almost all the AT commands can be executed in this mode. DATA MODE: The data inputted from uart is directly transported to the other side’s uart. Only one command can be executed to quit this DATA mode.

Commands:

1.Test command

Command Respond Parameter
AT\n OK\n\0 none

This command is used to test current local uart connection.

2.Show version command

send receive parameter
ON\n Version\n\0 none

This command is to show the current softeware version.

3.Restart command

send receive parameter
AT+RESTART\n none none

This command is for restarting the device.

4.Baudrate command

send receive parameter
AT+BAUD= OK:0\n\0 0\n
OK:1\n\0 1\n
OK:2\n\0 2\n
OK:3\n\0 3\n
OK:4\n\0 4\n
OK:B:baudrate\n\0 ?\n

This command is to set baudrate :

0---- >baudrate 9600

1---- >baudrate 19200

2---- >baudrate 38400

3---- >baudrate 57600

4---- >baudrate 115200

5.Peripheral name command

send receive parameter
AT+PNAME= OK\n\0 Name\n
OK:name\n\0 ?\n

This command is to set peripheral name.

A peripheral name is a string that has less than 20 char data.

This name can be always stored regardless of power on or not.

6.Central name command

send receive parameter
AT+CNAME= OK\n\0 Name\n
OK:name\n\0 ?\n

This command is to set central name.

A central name is a string that has less than 20 char data.

This name can be always stored regardless of power on or not.

7.Peripheral passcode command

send receive parameter
AT+PPIN= OK\n\0 Passcode\n
OK\n\0 0\n
OK:passcode\n\0 ?\n

This name is to set peripheral passcode.

A peripheral passcode is a 6-char string made up with ‘0’ ~ ‘9’.

For example: “012345”

When parameter is 0 , it means that there’s no passcode request during connecting.

8.Central passcode command

send receive parameter
AT+PPIN= OK\n\0 Passcode\n
OK:passcode\n\0 ?\n

This name is to set central passcode.

A central passcode is a 6-char string made up with ‘0’ ~ ‘9’.

For example: “012345”

9.Central and peripheral switch command

send receive parameter
AT+ROLE= ready\n\0 1\n
OK\n\0 0\n

This command is to switch device to be central or peripheral.

1--- > central

2--- > peripheral

When a device turns to be a central, It will auto discovery peripheral devices and auto connect the one who’s peripheral name matches its central name.

When a connection is build, both sides will receive string “ready\n\0”.

10.Status command

send receive parameter
AT+STATUS= N:name\n\0 N\n
M:mode\n\0 M\n
S:state\n\0 S\n
B:baudrate\n\0 B\n
N:name\n\0

M:mode\n\0

S:state\n\0

B:baudrate\n\0

\n


This command is used to show some information about the device:

N --- > peripheral name

M --- > peripheral or central

S --- >current system state

B --- >baudrate

This command can be for debug.

11.Peripheral advertise command

send receive parameter
AT+ADVER= OK\n\0 1\n
OK\n\0 0\n
OK:1\n\0

OK:0\n\0

?\n


This command is used for peripheral to start or stop advertising.

1 --- > start to advertise

0 --- > stop adverting

When a peripheral stop advertising, it can not be scanned or searched.

12.Peripheral terminate command

send receive parameter
AT+PTERM\n OK\n\0 none

This command is used for peripheral device to stop current connection.

13.Central RSSI command

send receive parameter
AT+RSSI= OK\n\0 1\n
OK\n\0 0\n

This command is used for central device to get RSSI.

1 --- > get RSSI. The RSSI will show to uart every second.

0 --- > stop getting RSSI.

14.AT mode send command

send parameter local receive Remote receive
AT+Send= AT\n OK\n\0

AT+RECEIVE:OK\n

AT+RECEIVE:AT\n
AT+VERSION\n OK\n\0

AT+RECEIVE:version\n

AT+RECEIVE:AT+VERSION\n
AT+BAUD=0\n OK\n\0

AT+RECEIVE:B:0\n

AT+RECEIVE:AT+BAUD=0\n
AT+BAUD=1\n OK\n\0

AT+RECEIVE:B:1\n

AT+RECEIVE:AT+BAUD=1\n
AT+BAUD=2\n OK\n\0

AT+RECEIVE:B:2\n

AT+RECEIVE:AT+BAUD=2\n
AT+BAUD=3\n OK\n\0

AT+RECEIVE:B:3\n

AT+RECEIVE:AT+BAUD=3\n
AT+BAUD=4\n OK\n\0

AT+RECEIVE:B:4\n

AT+RECEIVE:AT+BAUD=4\n
AT+BAUD=?\n OK\n\0

AT+RECEIVE:B:baudrate\n

AT+RECEIVE:AT+BAUD=?\n
AT+RESTART\n OK\n\0 OK\n\0
String\n OK\n\0 AT+RECEIVE:string\n

This command is used to send command or string to the other side in AT mode.

Not all the AT commands which can be sent and executed are list above. Like GPIO and ADC.

Users can use this command to send custom string to the other side to execute user’s own task.

15.AT mode and DATA mode switch command

send parameter local receive remote receive
AT+DATA= 1\n DT\n\0 AT+RECEIVE:AT+DATA on\n

DT\n\0

0\n AT\n\0 AT+DATA 0\n

AT\n\0

This command is used to switch to AT MODE or DATA MODE.

1--- > enter DATA mode. This command can not be executed in DATA mode.

2--- > enter AT mode. This command can only be used executed in DATA mode.

When two devices are connected, they can be switched into DATA mode.

Either the central or the peripheral enter to DATA mode, both devices will enter DATA mode.

Either the central or the peripheral enter to AT mode, both devices will enter AT mode.

In DATA mode , data from one side uartcan be transported directly to the other side’s uart.

The “local” is that the side you input. The “remote” is the other side.

16.Debug command

send receive parameter
AT+DB= OK\n\0 1\n
OK\n\0 0\n
OK:0\n\0

OK:1\n\0

?\n


This command is used to set flag to show debug information or not.

0 ---> show debug information.

1--- > stop showing debug information

When 1 is set, more system debug information will show to uart.

17.GPIO SET command

send receive parameter
AT+GPIOSET= OK\n\0 1\n
OK\n\0 2\n
OK\n\0 3\n
OK\n\0 4\n
OK\n\0 5\n
OK\n\0 6\n
OK\n\0 9\n
OK\n\0 10\n
OK\n\0 13\n
OK\n\0 14\n
OK\n\0 15\n
OK\n\0 16\n

This command is used to set a pin to GPIO.

The parameter number is the pin index in pinmap.

This command must be used before AT+IOWRITE and AT+IOREAD.

Whenever a pin is set to GPIO, the pin can’t be used as other functions.

18.GPIO write command

send receive parameter
AT+GPIORD= OK:0\n\0

OK:1\n\0

1\n
OK:0\n\0

OK:1\n\0

2\n
OK:0\n\0

OK:1\n\0

3\n
OK:0\n\0

OK:1\n\0

4\n
OK:0\n\0

OK:1\n\0

5\n
OK:0\n\0

OK:1\n\0

6\n
OK:0\n\0

OK:1\n\0

9\n
OK:0\n\0

OK:1\n\0

10\n
OK:0\n\0

OK:1\n\0

13\n
OK:0\n\0

OK:1\n\0

14\n
OK:0\n\0

OK:1\n\0

15\n
OK:0\n\0

OK:1\n\0

16\n

This command is used to set a GPIO to output high or low.

The first number of parameter is the pin index in pinmap, and the second number is :

1 ---> output high

0 ---> output low

This command must be used after AT+GPIOSET.

19.GPIO read command

send receive parameter
AT+GPIORD= OK:0\n\0

OK:1\n\0

1\n
OK:0\n\0

OK:1\n\0

2\n
OK:0\n\0

OK:1\n\0

3\n
OK:0\n\0

OK:1\n\0

4\n
OK:0\n\0

OK:1\n\0

5\n
OK:0\n\0

OK:1\n\0

6\n
OK:0\n\0

OK:1\n\0

9\n
OK:0\n\0

OK:1\n\0

10\n
OK:0\n\0

OK:1\n\0

13\n
OK:0\n\0

OK:1\n\0

14\n
OK:0\n\0

OK:1\n\0

15\n
OK:0\n\0

OK:1\n\0

16\n

This command is used to read a GPIO .

The number of parameter is the pin index in pinmap, and the return number is :

1 ---> high

0 ---> low

This command must be used after AT+GPIOSET.

20.ADC IO set command

send receive parameter
AT+ADSET= OK\n\0 13\n
OK\n\0 14\n
OK\n\0 15\n
OK\n\0 16\n

This command is used to set an io to ADC function .

The number of parameter is the pin index in pinmap :

13 ---> P0_5 (A5)

14 ---> P0_4 (A4)

15 ---> P0_3 (A3)

16 ---> P0_2 (A2)

This command must be used before AT+ADREAD.

21.ADC reference command

send receive parameter
AT+ADREF= OK\n\0 0\n
OK\n\0 1\n
OK:0\n\0

OK:1\n\0

?\n

This command is used to set ADC referencevoltage.

The number of parameter :

0 --->internallygenerated voltage (1.25V) ,default.

1 --->AVDD5 (3.3V)

This command must be used before AT+ADREAD. And this command is optional.

Be careful that the ADC input voltage must not be higher than the reference voltage.

22.ADC read command

send receive parameter
AT+ADREAD= OK:0xRESULT\n\0 13\n
OK:0xRESULT\n\0 14\n
OK:0xRESULT\n\0 15\n
OK:0xRESULT\n\0 16\n

This command is used to read an ADC channel.

The number of parameter is the pin index in pinmap :

13 ---> P0_5 (A5)

14 ---> P0_4 (A4)

15 ---> P0_3 (A3)

16 ---> P0_2 (A2)

This command must be used after AT+ADSET.

The ADC is 14-bit and this command gets the first 12-bit number.

The RESULT here is from 0~7FF in a string. For example ,”OK:0x7FF\n\0”“OK:0x0\n\0”. That 0x0 means the 0V and 0x7FF means the reference voltage.

Error Messages

Sometimes the commands above do not return correctly and show some messages in strings like “error:0x8A\n\0”. It means something is wrong. Here are the error strings and their meanings for you to check.

Error string: Message:
error:0x80\n\0 Unknow input source. (Neither uart nor air)
error:0x81\n\0 Unknown AT mode.(Neither AT nor DATA)
error:0x82\n\0 AT command buffer is over flowed.(Send “AT\n” to check)
error:0x83\n\0 Unknown AT command.
error:0x84\n\0 Unknown Uartbaudrate.
error:0x86\n\0 Unknown device’s mode.(Neither central nor peripheral)
error:0x87\n\0 Input AT command’s parameter is wrong.
error:0x88\n\0 Fail to read scanRspData.
error:0x89\n\0 Fail to read devicename.
error:0x8A\n\0 Input IO index is wrong.
error:0x8B\n\0 Input IO index has been used as other functions.

Download

File:IM150611001-BLE Bee-datasheet.pdf

File:CC2541_User_Guide.pdf

File:IM150611001-BLE Bee-dimension.pdf

File:IM150611001-BLE Bee-schematic.pdf

File:IM150611001-BLE Bee-view.pdf

File:OAD_for_CC254x.pdf