Chapter 3 – AT Commands,
Setting Parameters
This section covers how to send AT commands at the PC connected to a BlueTooth Adapter to query and set parameters for Bluetooth communication.
Example of a Slave Command Sequence
From Power Up:
1.Check and verify Communication to Slave. Sent : AT<cr_lf> Reply:<cr_lf>OK<cr_lf>
2.Get information on Slave Bluetooth address. Sent : ATSI,1<cr_lf>
Reply:
3.Set Slave to automatically connect in Fast Data Mode and SPP on Bluetooth connection. Sent : ATSW25,0,0,0,0 <cr_lf>
Reply:<cr_lf>OK<cr_lf>
4.Either cycle power or send ATURST.
Note: This command sequence assumes the radio is in factory default in which it automatically comes up and is connectable as a Slave from a Master request.
Example of a Master Discovery/Connection Sequence
From Power Up and No Connection
1.Verify local device is Master in Data Mode. Sent: ATSi,7 <cr_lf>
Reply: <cr_lf>1,1,0,0<cr_lf>
2.If not Master, set to Master and Data Mode. Sent: ATSW25,1,1,0,0 <cr_lf>
Reply: <cr_lf>OK<cr_lf>
3.Perform an Inquiry to obtain BT_Addresses (unless it is already known).
Sent: ATMC <cr_lf> | // Places Radio in Command Mode |
Reply: <cr_lf>OK<cr_lf> |
|
Sent: ATUCL | // Clears radio state |
Reply: <cr_lf>OK<cr_lf> |
|
Sent: ATDI,1,00000000 {Class of Device}<cr_lf> | // Looks for only one Bluetooth device |
Reply: <cr_lf>00A0961F2023,00000104,SOCKETWIRELESS<cr_lf>DONE<cr_lf>CONNECT
<cr_lf>
4.Perform a Master Connect over SPP using the BT_Address.
| Sent : ATDM, 00A0961F2023,1101<cr_lf> | // SPP connection |
| Reply:<cr_lf>CONNECT,00A0961F008F <cr_lf> | // Returns Slave BT address radios is in data |
5. | Place radio into Fast Data Mode. | mode |
| ||
| Sent : ATMC <cr_lf> | // Places Radio in Command Mode |
| Reply:<cr_lf>OK<cr_lf> |
|
| Sent : ATMF<cr_lf> | // Places radio in Fast Data Mode |
6. | Reply:<cr_lf>OK<cr_lf> |
|
Send Data. |
|
Note about Sending Commands from the Slave When the Slave Connects in Fast Data Mode (ATSW25/or issuing ATMF)
All valid AT commands sent through the Slave's UART will be interpreted and responded by the Master as if it were the local Slave radio. Basically, in this configuration from the Slave end, you can obtain status and configure the remote Master radio. This is a unique feature that may be useful in some applications, but it can be confusing if you think you are talking to the Slave.
To Get Out of Data Mode and Check Status
1.Delay at least 50 milliseconds; this could be less or more.
2.Perform a Set Command Mode. Sent : ATMC<cr_lf> Reply:<cr_lf>OK<cr_lf>
3.Delay at least 50 milliseconds.
4.Check Status, perform a Disconnect … Sent : AT<cr_lf> Reply:<cr_lf>OK<cr_lf>
Note about Being Connected in Fast Data Mode
If connected in Fast Data Mode, it is necessary to reset the device to break the connection.
12 |