Objective
This hands-on application example outlines the basic Command mode operation for the RN4020.
You will learn:
- How to setup basic communications between your PC and the RN4020.
- How to enter Command mode
- Commands that review the current configuration settings of the module
- Commands that reset the module
Materials
Hardware Tools
Tool | About | Purchase |
---|---|---|
| |
Software Tools
This lab requires the following software tools:
Connection Diagram
A host is required to enter commands that configure the module. The following connections are required at a minimum:
If you are using the RN4020 PICTail, UART_TX, UART_RX, and WAKE_SW are already connected as shown.
In an embedded application, WAKE_SW is connected to a digital output pin of the host MCU, to control entry/exit from Command mode. The MCU Interfacing page covers the complete pin interface in more detail.
Procedure
The following procedure is performed on a Windows 7 computer, using Tera Term terminal emulator software.
7
To view critical information about our device over the UART, we simply issue the D command:
and the module will respond with the following information:
- Device MAC Address
- Device Name
- Device Connection Role (Central or Peripheral)
- Connected Device: Show the MAC address and address type (Public or Random) if connected, or “no” if no active connection
- Bonded Device: Show the MAC address and address type (Public or Random) if connected, or “no” if no bonding device
- Server Services: Bitmap of services that are supported in the server role
- Features(1): Current value of features bitmap. Refer to “SR” command
- Transmit Power(1): Current value of transmit power. Refer to “SP” command
10
The last command we will go over in this brief introduction is the SF command. This command resets the configurations to the factory default at the next reboot. The parameters for this command can be either 1 or 2.
When the input parameter is 1, a majority of the settings will be restored to the factory default, but some settings, such as device name, device info, script, and private services, stay the same. When the input parameter is 2, all parameters are restored to factory default. For this example we entered SF,1 and the module responds with "AOK".
Conclusions
This lab has briefly introduced you to some of the ASCII commands used to control and configure the RN4020 module. To learn more about the RN4020, the RN4020 PICTail, or to view the entire RN4020 command set, please view the following: