RN4870/71 Bluetooth
®
Low Energy Module User’s Guide
DS50002466A-page 12 2016 Microchip Technology Inc.
1.2.4 Embedded Scripting Feature
RN4870/71 supports script functionality. The script capability is unique to Microchip RN
modules that enables the user to write ASCII based script into RN4870/71 NVM and
automatically execute the application logic through the script. The script capability
enables RN4870/71 to run relatively simple operations without a host MCU.
1.2.5
Remote Command Console
RN4870/71 supports Remote Command mode which allows a remote device to access
Command mode remotely via Bluetooth link. This feature requires UART Transparent
function to be enabled first.
1.3 COMMAND MODE AND DATA MODE
The RN4870/71 operates in two modes: Data mode (default) and Command mode.
When RN4870/71 is connected to another BLE device and is in Data mode, the
RN4870/71 acts as a data pipe: any serial data sent into RN4870/71 UART is trans-
ferred to the connected peer device via Transparent UART Bluetooth service. When
data is received from the peer device over the air via Transparent UART connection,
this data outputs directly to UART.
For configuration or control operation, or both, set the RN4870/71 into Command
mode. In Command mode, all UART data is treated as ASCII commands sent to the
module's UART interface.
As illustrated in Figure 1-1, the RN4870/71 can enter and exit Command and Data
mode using ASCII command over UART or over configurable PIO.
To enter Command mode from Data mode, type $$$ character sequence after 100 ms
delay before the first $. A CMD> prompt is sent to UART to notify the external host of
the start of the Command mode. The Data mode escape character can change from $
to another character using S$ command.
To return to Data mode, enter command --- at the command prompt. The END mes-
sage displays indicating the end of command console session.
In addition to using ASCII Command mode escape character and the command --- to
enter/exit Command mode, it is possible to configure a PIO to do the same. This
method is more suitable for applications where there is a need for the host MCU to
enter and exit the Command mode.
FIGURE 1-1: COMMAND MODE AND TRANSPARENT UART (DATA) MODE
RN4870
UART
CMD>
GATT
GATT/Transparent UART
BTLE Device
x iOS
x Android
x RN4870
x PC
---/PIO
$$$/PIO
HOST
MCU
PIO