Difference between revisions of "HM-100"
m (→Download) |
m (→Overview) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Overview== | ==Overview== | ||
+ | [[File:im150627001_1_.jpg|thumb|400px|right]] | ||
[[HM-100]] 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 can replace HC-05, HC-06, HC-07 and HM-10. It supports both central mode and peripheral mode on one module. And it supports remote control to the other side which is connected, like GPIO control and ADC. You can use custom commands when you combine it with other devices. And of course without complex PCB layout or deep knowledge about BLE ,you can easily put it in your own SOCs. | [[HM-100]] 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 can replace HC-05, HC-06, HC-07 and HM-10. It supports both central mode and peripheral mode on one module. And it supports remote control to the other side which is connected, like GPIO control and ADC. You can use custom commands when you combine it with other devices. And of course without complex PCB layout or deep knowledge about BLE ,you can easily put it in your own SOCs. | ||
Note: | Note: | ||
The serial interface is 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. | The serial interface is 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. | ||
+ | |||
+ | Go shopping [http://imall.itead.cc/im150627001.html HM-100 (im150627001)] | ||
==Specifications== | ==Specifications== | ||
Line 922: | Line 925: | ||
| error:0x8B\n\0||Input IO index has been used as other functions. | | error:0x8B\n\0||Input IO index has been used as other functions. | ||
|} | |} | ||
+ | |||
+ | ==HM-100 and HM-10== | ||
+ | The hardware of HM-100 is almost same with HM-10, but the firmware is different. Here’re some differences between them. | ||
+ | *All of HM-100 GPIOs can be used by users.HM-10 has PIO0 as key and PIO1 as state LED by default. | ||
+ | *The AT command of HM-100 has‘\r’ or ‘\n’ as an end and ‘=’ as a start of parameter. HM-10 does not need these. | ||
+ | *When an HM-100 becomes a central device, it will automatically search the peripheral | ||
+ | which name is set before, and connect to it. HM-10 does not have this function. | ||
+ | *When an HM-100 peripheral receives wrong password sent by the central, it will | ||
+ | automatically terminate the connection. HM-10 does not have this function. | ||
+ | *HM-100 sets the RF power to 0dbm by default. HM-10 has one command to let user to set | ||
+ | the power. | ||
+ | *HM-100 does not have command to control UART stop-bit and parity-bit. HM-10 has commands to do it. | ||
+ | *HM-100 builds a connection only by device name which is set before a connection. HM-10 | ||
+ | also uses address to build a connection. | ||
+ | *HM-100 has commands to control 8-channal ADC either by local or by remote. HM-10 does not have this function | ||
==Revision History== | ==Revision History== | ||
Line 931: | Line 949: | ||
|- | |- | ||
| V0.1.1||Initial version||2015-07-06 | | V0.1.1||Initial version||2015-07-06 | ||
+ | |- | ||
+ | | V0.1.2||Add differences between HM-100 and HM-10||2015-07-15 | ||
|} | |} | ||
==Download== | ==Download== | ||
− | [[:File: | + | [[:File:Serial Port BLE Module HM100-datasheet.pdf]] |
[[:File:HM-100-dimension.pdf]] | [[:File:HM-100-dimension.pdf]] |
Latest revision as of 01:26, 22 July 2015
Contents
- 1 Overview
- 2 Specifications
- 3 Electrical Characteristics
- 4 Hardware
- 5 Pinmap
- 6 Software
- 7 At Commands
- 7.1 Test command
- 7.2 Show version command
- 7.3 Restart command
- 7.4 Baudrate command
- 7.5 Peripheral name command
- 7.6 Central name command
- 7.7 Peripheral passcode command
- 7.8 Central passcode command
- 7.9 Central and peripheral switch command
- 7.10 Status command
- 7.11 Peripheral advertise command
- 7.12 Peripheral terminate command
- 7.13 Central RSSI command
- 7.14 AT mode send command
- 7.15 AT mode and DATA mode switch command
- 7.16 Debug command
- 7.17 GPIO SET command
- 7.18 GPIO write command
- 7.19 GPIO read command
- 7.20 ADC IO set command
- 7.21 ADC reference command
- 7.22 ADC read command
- 8 Error Messages
- 9 HM-100 and HM-10
- 10 Revision History
- 11 Download
Overview
HM-100 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 can replace HC-05, HC-06, HC-07 and HM-10. It supports both central mode and peripheral mode on one module. And it supports remote control to the other side which is connected, like GPIO control and ADC. You can use custom commands when you combine it with other devices. And of course without complex PCB layout or deep knowledge about BLE ,you can easily put it in your own SOCs.
Note: The serial interface is 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.
Go shopping HM-100 (im150627001)
Specifications
PCB size | 26.9mm X 13.0mm X 1.0mm |
Power supply | 3.0~3.3V DC |
Microprocessor | CC2541 |
Electrical Characteristics
Specification | Min | Type | Max | Unit |
PowerVoltage | 3 | - | 3.3 | VCC |
Input VoltageVH
Target Voltage = 3.3V |
3 | 3.3 | 3.3 | V |
Input Voltage VL: | -0.3 | 0 | 0.5 | V |
Current Consumption | - | - | 15 | mA |
Hardware
Pinmap
INDEX | NAME | FUCTION | DESCRIPTION |
1 | P1.6 | UART_TX | UART interface |
2 | P1.7 | UART_RX | UART interface |
3 | P1.4 | UART_CTS | UART interface |
4 | P1.5 | UART_RTS | UART interface |
5 | NC | NC | Not used |
6 | NC | NC | Not used |
7 | P2.2 | GPIO/DEBUG | GPIO or Debug interface |
8 | P2.1 | GPIO/DEBUG | GPIO or Debug interface |
9 | P2.0 | GPIO | GPIO |
10 | NC | NC | Not used |
11 | RESET | RESET | Reset. Debug interface |
12 | 3.3V | 3.3V | Power supply |
13 | GND | GND | Ground |
14 | GND | GND | Ground |
15 | SDA | GPIO | GPIO |
16 | NC | NC | Not used |
17 | NC | NC | Not used |
18 | NC | NC | Not used |
19 | NC | NC | Not used |
20 | SCL | GPIO | GPIO |
21 | GND | GND | Ground |
22 | GND | GND | Ground |
23 | P1.3 | GPIO | GPIO |
24 | P1.2 | GPIO | GPIO |
25 | P1.1 | GPIO | GPIO |
26 | P1.0 | GPIO | GPIO |
27 | P0.7 | GPIO/ADC | GPIO or ADC |
28 | P0.6 | GPIO/ADC | GPIO or ADC |
29 | P0.5 | GPIO/ADC | GPIO or ADC |
30 | P0.4 | GPIO/ADC | GPIO or ADC |
31 | P0.3 | GPIO/ADC | GPIO or ADC |
32 | P0.2 | GPIO/ADC | GPIO or ADC |
33 | P0.1 | GPIO/ADC | GPIO or ADC |
34 | P0.0 | GPIO/ADC | GPIO or ADC |
Note:
- HM-100 is pin to pin with HM-10. 100% compatible on hardware.
- The default uart interface is USART0’s P1.7(RX) and P1.6 (TX).
- The debug interface can be used to re-program the CC2541 chip.
- Except uart, I2C and debug interface , other pins are default idle state.
- GPIO and ADC are supported with current software.
Software
The current software supports central mode and peripheral mode. One HM-100 can only be in one mode at one time. This can be switched by AT commands.
Each HM-100 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 HM-100 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 HM-100 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. A peripheral does not request any passcode defaultly.
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:
Test command
send | receive | parameter |
AT\n | OK\n\0 | none |
This command is used to test current local uart connection.
Show version command
send | receive | parameter |
AT+VERSION\n | Version\n\0 | none |
This command is to show the current softeware version.
Restart command
send | receive | parameter |
AT+RESTART\n | none | none |
This command is for restarting the device.
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
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.
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.
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.
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”
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”.
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.
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.
Peripheral terminate command
send | receive | parameter |
AT+PTERM\n | OK\n\0 | none |
This command is used for peripheral device to stop current connection.
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.
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.
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.
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.
GPIO SET command
send | receive | parameter |
AT+GPIOSET= | OK\n\0 | 7\n |
OK\n\0 | 8\n | |
OK\n\0 | 9\n | |
OK\n\0 | 15\n | |
OK\n\0 | 20\n | |
OK\n\0 | 23\n | |
OK\n\0 | 24\n | |
OK\n\0 | 25\n | |
OK\n\0 | 26\n | |
OK\n\0 | 27\n | |
OK\n\0 | 28\n | |
OK\n\0 | 29\n | |
OK\n\0 | 30\n | |
OK\n\0 | 31\n | |
OK\n\0 | 32\n | |
OK\n\0 | 33\n | |
OK\n\0 | 34\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.
GPIO write command
send | receive | parameter |
AT+GPIOWR= | OK\n\0 | 7,1\n |
OK\n\0 | 7,0\n | |
OK\n\0 | 8,1\n | |
OK\n\0 | 8,0\n | |
OK\n\0 | 9,1\n | |
OK\n\0 | 9,0\n | |
OK\n\0 | 15,1\n | |
OK\n\0 | 15,0\n | |
OK\n\0 | 20,1\n | |
OK\n\0 | 20,0\n | |
OK\n\0 | 23,1\n | |
OK\n\0 | 23,0\n | |
OK\n\0 | 24,1\n | |
OK\n\0 | 24,0\n | |
OK\n\0 | 25,1\n | |
OK\n\0 | 25,0\n | |
OK\n\0 | 26,1\n | |
OK\n\0 | 26,0\n | |
OK\n\0 | 27,1\n | |
OK\n\0 | 27,0\n | |
OK\n\0 | 28,1\n | |
OK\n\0 | 28,0\n | |
OK\n\0 | 29,1\n | |
OK\n\0 | 29,0\n | |
OK\n\0 | 30,1\n | |
OK\n\0 | 30,0\n | |
OK\n\0 | 31,1\n | |
OK\n\0 | 31,0\n | |
OK\n\0 | 32,1\n | |
OK\n\0 | 32,0\n | |
OK\n\0 | 33,1\n | |
OK\n\0 | 33,0\n | |
OK\n\0 | 34,1\n | |
OK\n\0 | 34,0\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.
GPIO read command
send | receive | parameter |
AT+GPIORD= | OK:0\n\0
OK:1\n\0 |
7\n |
OK:0\n\0
OK:1\n\0 |
8\n | |
OK:0\n\0
OK:1\n\0 |
9\n | |
OK:0\n\0
OK:1\n\0 |
15\n | |
OK:0\n\0
OK:1\n\0 |
20\n | |
OK:0\n\0
OK:1\n\0 |
23\n | |
OK:0\n\0
OK:1\n\0 |
24\n | |
OK:0\n\0
OK:1\n\0 |
25\n | |
OK:0\n\0
OK:1\n\0 |
26\n | |
OK:0\n\0
OK:1\n\0 |
27\n | |
OK:0\n\0
OK:1\n\0 |
28\n | |
OK:0\n\0
OK:1\n\0 |
29\n | |
OK:0\n\0
OK:1\n\0 |
30\n | |
OK:0\n\0
OK:1\n\0 |
31\n | |
OK:0\n\0
OK:1\n\0 |
32\n | |
OK:0\n\0
OK:1\n\0 |
33\n | |
OK:0\n\0
OK:1\n\0 |
34\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.
ADC IO set command
send | receive | parameter |
AT+ADSET= | OK\n\0 | 27\n |
OK\n\0 | 28\n | |
OK\n\0 | 29\n | |
OK\n\0 | 30\n | |
OK\n\0 | 31\n | |
OK\n\0 | 32\n | |
OK\n\0 | 33\n | |
OK\n\0 | 34\n |
This command is used to set an io to ADC function .
The number of parameter is the pin index in pinmap :
27 ---> P0_7 (A7)
28 ---> P0_6 (A6)
29 ---> P0_5 (A5)
30 ---> P0_4 (A4)
31 ---> P0_3 (A3)
32 ---> P0_2 (A2)
33 ---> P0_1 (A1)
34 ---> P0_0 (A0)
This command must be used before AT+ADREAD.
ADC reference command
send | receive | parameter |
AT+ADREF= | OK\n\0 | 0\n |
OK\n\0 | 1\n | |
OK:0\n\0 | ?\n | |
OK:1\n\0 |
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.
ADC read command
send | receive | parameter |
AT+ADREAD= | OK:0xRESULT\n\0 | 27\n |
OK:0xRESULT\n\0 | 28\n | |
OK:0xRESULT\n\0 | 29\n | |
OK:0xRESULT\n\0 | 30\n | |
OK:0xRESULT\n\0 | 31\n | |
OK:0xRESULT\n\0 | 32\n | |
OK:0xRESULT\n\0 | 33\n | |
OK:0xRESULT\n\0 | 34\n |
This command is used to read an ADC channel.
The number of parameter is the pin index in pinmap :
27 ---> P0_7 (A7)
28 ---> P0_6 (A6)
29 ---> P0_5 (A5)
30 ---> P0_4 (A4)
31 ---> P0_3 (A3)
32 ---> P0_2 (A2)
33 ---> P0_1 (A1)
34 ---> P0_0 (A0)
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. |
HM-100 and HM-10
The hardware of HM-100 is almost same with HM-10, but the firmware is different. Here’re some differences between them.
- All of HM-100 GPIOs can be used by users.HM-10 has PIO0 as key and PIO1 as state LED by default.
- The AT command of HM-100 has‘\r’ or ‘\n’ as an end and ‘=’ as a start of parameter. HM-10 does not need these.
- When an HM-100 becomes a central device, it will automatically search the peripheral
which name is set before, and connect to it. HM-10 does not have this function.
- When an HM-100 peripheral receives wrong password sent by the central, it will
automatically terminate the connection. HM-10 does not have this function.
- HM-100 sets the RF power to 0dbm by default. HM-10 has one command to let user to set
the power.
- HM-100 does not have command to control UART stop-bit and parity-bit. HM-10 has commands to do it.
- HM-100 builds a connection only by device name which is set before a connection. HM-10
also uses address to build a connection.
- HM-100 has commands to control 8-channal ADC either by local or by remote. HM-10 does not have this function
Revision History
Rev. | Description | Release date |
V0.1.1 | Initial version | 2015-07-06 |
V0.1.2 | Add differences between HM-100 and HM-10 | 2015-07-15 |