The RN4020 provides a flexible MCU interface, which can be tailored to your specific needs. The most basic interface requires two Universal Asynchronous Receiver Transmitter (UART) interface signals, as well as two control signals, which place the module in a number of power states.
The RN4020 is configured and controlled with a simple ASCII command language. The “RN4020 Bluetooth® Low Energy (BLE) Module User's Guide" contains a complete listing and details of the ASCII command interface. Note that many of the module status/control states are visible and controllable via General Purpose Input/Output (GPIO) pins, simplifying MCU firmware and state-machine development.
Please refer to the following documentation for more details on the MCU signal interface:
Basic Interface
In the simplest configuration, the module requires two UART interface signals (TX and RX), as well as two control signals (WAKE_HW and WAKE_SW), which place the module in a number of power states.
Two additional status signals (PIO3/WAKE_STATUS and PIO1/BLE_CONNECTION) are also recommended to simplify MCU interfacing.
Note: The module does not have a RESET pin function. The state of the module can be queried and controlled via ASCII commands and responses.
The default port configuration for the UART is described in the table below:
Parameter | Value |
---|---|
Baud Rate | 115200 |
Data Bits | 8 |
Parity | None |
Stop Bits | 1 |
Flow Control | None |
WAKE_HW
This pin has a dual function. It is used (in conjunction with WAKE_SW) to place the module in the Dormant power state. It may also be used to trigger a factory reset by issuing three HIGH-LOW-HIGH transitions within the first five seconds after power-up.
WAKE_HW contains an internal pull-down resistor.
WAKE_SW
This pin is used to control the power state of the device. A LOW-HIGH transition moves the module from Deep Sleep to Idle state, whereby the command interface is activated and the host MCU can communicate with the module. The module will output CMD to the UART to indicate the module is in Command mode.
PIO3/WAKE_STATUS is also asserted by the module when in Command mode.
Upon a HIGH-LOW transition, the module exits Command mode by outputting END to the UART. It will then operate in Deep Sleep mode.
PIO3/WAKE_STATUS
This pin is asserted when the module enters/exits Command mode. It may be monitored by the host MCU to speed up entry/exit from Command mode.
PIO1/BLE_CONNECTION
This pin is asserted when the module establishes a BLE connection with another node.
Basic Interface + CTS/RTS Flow Control
If you plan to upgrade the RN4020 firmware via UART interface, or are planning to use the Microchip Low-Energy Data Profile (MLDP), then CTS (pin 14)/RTS (pin 18) hardware flow control connections are also required.
Basic Interface + CTS/RTS Flow Control + MLDP Operation
The MLDP is a private BLE service that enables applications to move serial data over BLE; it basically turns the interface into a simple UART. MLDP provides a 50 kbps serial data transport over BLE on the RN4020. Built on top of BTLE Generic Attribute Profile (GATT), Microchip developed the private service MLDP to simulate the operation of Classic Bluetooth's Serial Port Profile (SPP).
After enabling MLDP functionality via ASCII command, this mode of operation may be managed via an additional two signals:
CMD/MLDP
With the MLDP function enabled for a module, this pin controls whether the data interface carries RN4020 Commands or MLDP data.
- CMD/MLDP = 1 (MLDP Data)
- CMD/MLDP = 0 (Command Mode)
CMD/MLDP contains an internal pull-down resistor, so the pin will stay low if not pulled high.
PIO2/MLDP_EVENT
This pin is used as an "MLDP Data Event" indicator and may be monitored by the host MCU to determine whether there are any special status messages to be retrieved from the module. To retrieve the message, place the module in Command mode by setting CMD/MLDP low. The message will then be sent over the UART interface.