RFSOLUTIONS BRM01 2.4ghz bluetooth transceiver module programming guide Datasheet

2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
Introduction
The coherenceRF BRM allows fast development of sophisticated wireless
applications by embedding the complexities of the radio. This allows the BRM to
present a very simple API to the Host device, thus significantly easing wireless
integration into the customer’s end product.
This document describes the programming requirements for the BRM when used in
the ‘Enhanced’ mode of operation. Enhanced mode provides a non-transparent
interface allowing a more flexible and complex system to be built.
System Scenarios
Before detailing the programmer’s interface, it is useful to understand the possible system architectures.
Fixed Point to Point
This describes the most basic system
architecture. Data is always sent to and
received from the same device.
The Basic or Enhanced mode of
operation can handle this.
Point-ttoo-P
Pooiinntt S
Syysstteem
m
A
HpOpSliTcatuioPn
Platform
BRM
BRM
DEOVDIU
CE
M
LEA
DEOVDIU
CLEEB
M
(MASTER)
(SLAVE)
Sensor
Display
H OS T uP
Switch
Keypad
Fixed Point to Multi-Point System
SUPPLY
Fixed Point to Multi-Point
This is another basic system architecture.
Each BRM sets up a connection to a fixed
BRM, but may also accept a connection
from any known BRM. The Basic or
Enhanced mode of operation can handle
this.
Fixed Point to Multipoint
Host
Platform
The example shows devices B, C and D
fixed to device A.
The term ‘Master’ denotes only the device
that initialises the connection.
A Typical application might be where
devices B, C or D set-up a connection to
A when an event occurs which must be
reported.
SUPPLY
BRM
BRM
DEVICE A
DEVICE B
(MASTER)
(SLAVE)
SUPPLY
Valve
Switch
Keypad
SUPPLY
BRM
BRM
DEVICE C
DEVICE D
(SLAVE)
(MASTER)
SUPPLY
DS361-3 Dec 03
Sensor
Display
©2003 Reg. No. 227 4001, England
Freezer
SUPPLY
Page 1
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
Multi-Point To Multi-Point
Multi-Point to Multi-Point System
This is a more flexible architecture. Each BRM
can set-up a connection to any other BRM,
providing they are known to each other.
This architecture is only supported by the
Enhanced mode of operation.
BRM
DEVICE A
(M/S)
Host
Platform
A Typical application might be where device A
sets-up a connection to B, C and D in turn,
requesting status data from each one.
BRM
SUPPLY
Valve
Robot
DEVICE B
(M/S)
SUPPLY
BRM
BRM
DEVICE C
DEVICE D
(M/S)
(M/S)
SUPPLY
Freezer
SUPPLY
Version Information
Note: This data sheet refers to BRM01 modems with firmware versions 0.29 or later. The firmware version is
labelled on the modules
DS361-3 Dec 03
©2003 Reg. No. 227 4001, England
Page 2
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
Table of Contents
Introduction ....................................................................................................................................................... 1
System Scenarios ............................................................................................................................................. 1
MULTI-POINT TO MULTI-POINT ....................................................................................................................2
VERSION INFORMATION...............................................................................................................................2
Commands, Responses and Events............................................................................................................... 4
GENERAL RULES ........................................................................................................................................4
SUMMARY ..................................................................................................................................................4
DETAILED DESCRIPTIONS............................................................................................................................5
ADD DEVICE TO INDEX ...............................................................................................................................5
CONNECT TO DEVICE .................................................................................................................................5
DISCONNECT DEVICE..................................................................................................................................5
GPIO SET-UP ............................................................................................................................................6
GPIO OUTPUT ...........................................................................................................................................7
GPIO INPUT ..............................................................................................................................................7
GPIO MEASURE ........................................................................................................................................7
DEVICE ADDRESS .......................................................................................................................................8
LOCAL ADDRESS ........................................................................................................................................8
LOCAL NAME ..............................................................................................................................................8
SET LOCAL NAME .......................................................................................................................................8
REMOTE DEVICE NAME...............................................................................................................................9
QUALITY ....................................................................................................................................................9
RESET .......................................................................................................................................................9
CONNECT VOICE DEVICE ............................................................................................................................9
SLEEP .....................................................................................................................................................10
STATUS CODES ........................................................................................................................................10
DS361-3 Dec 03
©2003 Reg. No. 227 4001, England
Page 3
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
Commands, Responses and Events
When the BRM is set to ‘Enhanced ‘ mode several commands are available to the Host system.
General Rules
Except when sending or receiving payload data, or stated otherwise, commands, responses and events
are constructed using ASCII codes – i.e.. In the range from 0x00 to 0x7F.
Commands always result in a response and new commands must not be sent until a response to the
previous command has been received.
Responses consist of at least 1 Command Echo Byte and 2 ASCII Coded Status Bytes.
Status “00” = success
Return parameters are not sent for non “00” responses
Events occur from time to time and indicate connection failures and other critical events. Events always
comprise at least 3 bytes. The first byte indicates the type of event and the second and third bytes
indicate the status.
Summary
The table below provides a summary of the commands supported in V0.29 Firmware.
Commands
Name
Add Device To Index
Code
“A”
Parameter(s)
Address (12), ID (2)
Description
Adds a device to the local index
Connect To Device
Disconnect Device
“C”
“D”
ID (2)
---------
Requests a data connection to a BRM
Disconnects the currently connected remote BRM
GPIO
“G”
Sets the GPIO pin functions (In/Out/ADC, Initial
state)
GPIO Output
GPIO Input
GPIO Measure
“>”
“<”
“$”
Direction (2)
Function (2)
Initialise (2)
ID (2), Mask (2)
ID (2), Null (2)
ID (2), Pin (2)
Outputs a GPIO bit mask to the GPIO pins
Inputs a byte which is a bit mask of the GPIO pins
Performs an ADC measurement on a GPIO pin
Device Address
“I”
ID (2)
Gets the device address stored in the local BRM
Set Local Name
Local Name
Local Address
“l”
“L”
“K”
Name (16)<CR>
-----------------
Sets a new local name for the local BRM
Gets the local BRM’s name
Gets the local BRM’s address
Remote Device Name
Reset
Quality
Connect Voice Device
“N”
“R”
“Q”
“V”
ID (2)
----------------ID (2)
Requests the name from a remote BRM
Performs a power-on-reset
Requests the link quality for a connection
Requests a voice+data connection to a device
Sleep
“Z”
---------
Sets BRM into low power sleep mode
DS361-3 Dec 03
©2003 Reg. No. 227 4001, England
Page 4
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
Events
Type
Connect
Code
“C”
Disconnect
“D”
Transaction complete
“S”
Parameters
Status (2),
Device ID (2)
Status (2),
Device ID (2)
Status (2)
Description
Connect occurred from device
Disconnect occurred from device - See Status
Codes
The data packet has completed. See Status
Codes
Detailed Descriptions
Add Device To Index
This command allows known devices to be added to the local BRM’s device list. Once in the device list each
connectable BRM is represented by an Index number. This allows incoming and outgoing connection
requests to be validated and identified.
Command Code
(1 byte)
“A”
Parameter 1 – BRM Address
(12 bytes 0-9, A-F)
“xxxxxxxxxxxx”
Parameter 2 – Index ID
(2 bytes 00-1F)
“xx”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“A”
“xx”
*See Status Codes for meanings
Connect To Device
This command requests an immediate connection to the device whose Index ID is provided in the parameter.
This is useful for testing purposes.
Command Code
(1 byte)
“C”
Parameter 1 – Index ID
(2 bytes 00-1F)
“xx”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“C”
“xx”
*See Status Codes for meanings
Device ID
(2 bytes 00-1F)
“xx”
Disconnect Device
This command requests an immediate disconnection from the currently connected remote device. This
command should be used after the local device has finished communicating to the remote device.
Command Code
(1 byte)
“D”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“D”
“xx”
*See Status Codes for meanings
DS361-3 Dec 03
Device ID
(2 bytes 00-1F)
“xx”
©2003 Reg. No. 227 4001, England
Page 5
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
GPIO Set-up
This command configures the GPIO functions for the BRM. Use this command to change the default settings
for the GPIO pins if used.
Command Code
(1 byte)
“G”
Parameter 1 – Direction
(2 bytes C0-FF)
“xx”
Parameter 2 – Function
(2 bytes 00-FF)
“xx”
Parameter 3 – Initialise
(2 bytes 00-FF)
“xx”
Direction Parameter
These two BCD bytes represent a bit mask to define which of the GPIO pins are inputs or outputs. Bits 0 to
5 control the GPIO pins GPIO0 to GPIO5 respectively. Bits 6 and 7 are reserved and should be set to ‘1’.
The GPIO pin will behave as an input and when the direction bit is set to ‘1’ and an output when set to a ‘0’.
By default GPIO pins are inputs. An example is given below:
Direction Value
FF
C3
GPIO5
Input
Output
GPIO4
Input
Output
GPIO3
Input
Output
GPIO2
Input
Output
GPIO1
Input
Output
GPIO0
Input
Output
Function Parameter
These two BCD bytes control the function of the GPIO pins. Valid codes are shown below;
Function Value
06
0E
0F
05
0D
0C
03
02
GPIO5
D I/O
D I/O
D I/O
D I/O
D I/O
ADC
ADC
ADC
GPIO4
D I/O
D I/O
D I/O
D I/O
D I/O
D I/O
D I/O
D I/O
GPIO3
D I/O
D I/O
REF+
REF+
REF+
REF+
REF+
ADC
GPIO2
D I/O
D I/O
REFD I/O
REFREFADC
ADC
GPIO1
D I/O
D I/O
D I/O
ADC
ADC
ADC
ADC
ADC
GPIO0
D I/O
ADC
ADC
ADC
ADC
ADC
ADC
ADC
Initialise Parameter
This parameter defines the initial Logic State of each GPIO pin when it is defined as an output. Values above
0x3F are not allowed. The two BCD bytes represent the bit mask of the 6 GPIO lines as given in the example
below:
Initialise Value
3F
26
GPIO5
High
High
GPIO4
High
Low
GPIO3
High
Low
GPIO2
High
High
GPIO1
High
High
GPIO0
High
Low
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“G”
“xx”
*See Status Codes for meanings
DS361-3 Dec 03
©2003 Reg. No. 227 4001, England
Page 6
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
GPIO Output
This command outputs a bit mask to the GPIO pins device whose Index ID is provided in parameter 1. GPIO
pins that are defined as outputs will be set to the level provided in the parameter 2 bit mask.
Command Code
(1 byte)
“>”
Parameter 1 – Index ID
(2 bytes 00-1F)
“xx”
Parameter 2 – Bit Mask
(2 bytes 00-FF)
“xx”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“>”
“xx”
*See Status Codes for meanings
GPIO Input
This command returns the digital level on the GPIO pins of the device whose Index ID is provided in
parameter 1. Values returned for GPIO pins that are not defined as digital inputs should be disregarded.
Command Code
(1 byte)
“<”
Parameter 1 – Index ID
(2 bytes 00-1F)
“xx”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“<”
“xx”
*See Status Codes for meanings
Parameter 2 – Null
(2 bytes 00)
“00”
GPIO Input Bit Mask
(2 bytes 0-9, A-F)
“xx”
GPIO Measure
This command returns the analogue level of the GPIO pin defined in parameter 2 from the device whose
Index ID is provided in parameter 1. Values returned for GPIO pins that are not defined as analogue inputs
should be disregarded.
Command Code
(1 byte)
“$”
Parameter 1 – Index ID
(2 bytes 00-1F)
“xx”
Parameter 2 – GPIO Pin
(2 bytes 00,01,02,03,05)
“xx”
Response Code
Status Code *
Analogue 10 bit value
(1 byte)
(2 bytes 0-9, A-F)
(2 bytes 0x0-03ff)
“$”
“xx”
0-4096
*See Status Codes for meanings
The analogue reference for the ADC measurement depends upon the Function Parameter of the GPIO setup command.
DS361-3 Dec 03
©2003 Reg. No. 227 4001, England
Page 7
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
Device Address
This command gets the device address for the device whose Index ID is provided in the parameter. This
allows verification of the device address entry against the Index ID.
Command Code
(1 byte)
“I”
Parameter 1 – Index ID
(2 bytes 00-1F)
“xx”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“I”
“xx”
*See Status Codes for meanings
Device Address
(12 bytes 0-9, AF)
“xxxxxxxxxxxx”
Local Address
This command gets the local device address.
Command Code
(1 byte)
“K”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“K”
“xx”
*See Status Codes for meanings
Device Address
(12 bytes 0-9, AF)
“xxxxxxxxxxxx”
Local Name
This command gets the device name from the local device.
Command Code
(1 byte)
“L”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“L”
“xx”
*See Status Codes for meanings
Device Name
(0-21 byte null terminated string)
“abcdefghijklmnopqrst” 0x00
Set Local Name
This command sets the local name.
Command Code
(1 byte)
“l”
Parameter 1 – Name
(1-16 byte string) <CR> (<16 char)
“abcdefghijklmnop”0x00
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“l”
“xx”
*See Status Codes for meanings
DS361-3 Dec 03
©2003 Reg. No. 227 4001, England
Page 8
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
Remote Device Name
This command requests the device name from the remote device whose Index ID is provided in the
parameter. The BRM attempts to make a temporary connection to the device and if successful requests its
Name. This allows a friendly Nametag to be used for each remote device. It can take several seconds for
the response to come back.
Command Code
Parameter 1 – Index ID
(1 byte)
(2 bytes 00-1F)
“N”
“xx”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“N”
“xx”
*See Status Codes for meanings
Device Name
(0-21 byte null terminated string)
“abcdefghijklmnopqrst” 0x00
Quality
This command gets the link quality for a device connection. The link quality response returns a hex coded
string in the range ‘00’ to ‘FF’. The higher the value the better the link quality.
Command Code
(1 byte)
“Q”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“Q”
“xx”
*See Status Codes for meanings
Link Quality
(2 bytes 0-9, A-F)
“xx”
Reset
This command performs a power-on-reset on the local BRM.
Command Code
(1 byte)
“R”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“R”
“xx”
*See Status Codes for meanings
Connect Voice Device
This command requests an immediate voice and data connection to the device whose Index ID is provided in the
parameter. This command is valid for a voice enabled remote device with external CODEC. First a standard data
connection is attempted. If this is successful a voice connection is added. This provides a full duplex 64kb/s voice link
with CVSD encoding over the air.
Command Code
(1 byte)
“V”
Parameter 1 – Index ID
(2 bytes 00-1F)
“xx”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“V”
“xx”
*See Status Codes for meanings
DS361-3 Dec 03
©2003 Reg. No. 227 4001, England
Page 9
2.4GHZ BLUETOOTH TRANSCEIVER MODULE
PROGRAMMING GUIDE
BRM01
Sleep
This command puts the local BRM into sleep mode in order to reduce power consumption to a minimum.
Sending a command at any time will wake the BRM.
Command Code
(1 byte)
“Z”
Parameter 1 – Index ID
(2 bytes 00-1F)
“xx”
Response Code
Status Code *
(1 byte)
(2 bytes 0-9, A-F)
“Z”
“xx”
*See Status Codes for meanings
Status Codes
Below is the list of possible response status codes
Response
Code
00
01
02
03
04
05
08
09
0B
0E
10
11
12
13
15
16
1F
Meaning
Command Completed Successfully
Unknown Command
No Connection
General Failure
Connection Request Failed
Authentication Failed
Connection Failed
No More Connections Allowed
Already Connected
Connection Rejected
Remote Device Failed To Respond
Invalid Feature
Invalid Parameter
Remote Device Ended Connection
Remote Device Is About To Power Off
Connection Ended By Local Host
Unspecified Error
For more information or general enquiries, please contact:
RF Solutions Ltd.,
Unit 21, Cliffe Industrial Estate,
South Street,
Lewes,
E Sussex, BN8 6JL. England
Tel +44 (0)1273 898 000
Email [email protected]
Fax +44 (0)1273 480 661
http://www.rfsolutions.co.uk
RF Solutions is a member of the Low Power Radio Association
All Trademarks acknowledged and remain the property of the respected owners
Information contained in this document is believed to be accurate, however no representation or warranty is given and R.F. Solutions Ltd. assumes no liability with respect to the accuracy of such information.
Use of R.F.Solutions as critical components in life support systems is not authorised except with express written approval from R.F.Solutions Ltd.
DS361-3 Dec 03
©2003 Reg. No. 227 4001, England
Page 10
Similar pages