link to page 21 link to page 24 link to page 24 RN4870/71 Bluetooth Low Energy Module User’s Guide2.6.26 M Command M is used to get the signal strength of the last communication with the peer device. The signal strength is used to estimate the distance between the device and its remote peer. Command M does not expect any parameter. The return value of command M is the signal strength in dBm. Example: M // Check the signal strength of last communication // with peer device Response: <RSSI> // Signal strength reading ERR // Not connected 2.6.27 O,0 Command O,0 puts the module immediately, without any UART response, into Dor- mant Power-Saving mode that consumes little power. In this mode, the module enters a Deep Sleep state where there is no RF communication, and the current drawn by the module is the lowest. The host MCU must force the module out of the Shutdown mode if it needs the module to communicate with peer device. On wake-up from Dormant mode, the module starts out of Reset. If UART_RX_IND functionality is activated using the Power-Saving mode by enabling command SO,1 (refer to command SO 2.4.19), then UART_RX_IND can be used to wake up the module from Dormant mode. The UART_RX_IND pin must be pulled high before entering the Dormant mode. To wake up the module after entering Dormant mode, pull the UART_RX_IND pin low. If UART_RX_IND functionality is not available, then the module enters the Dormant mode when O,0 command is issued and can only wake up when Hard Reset is performed. Example: O,0 // Enter low-power Dormant mode Response: // No response is sent as the module // immediately enters the Dormant mode 2.6.28 R,1 This command forces a complete device reboot (similar to a reboot or power cycle). It has one mandatory parameter of 1. After rebooting RN4870/71, all prior made setting changes takes effect. Example: R,1 // Reboot device Response: // Rebooting %REBOOT% // Status string 2.6.29 T,<hex16>,<hex16>,<hex16>,<hex16> Command T is used to change the following connection parameters: interval, latency and supervision time-out for current connection. The parameters of command T are lost after reboot or power cycle. All parameters are 16-bit values in hex format. Com- mand T is only effective if active connection exists when the command is issued. For the definitions, ranges and relationships of connection interval, latency and time- out, refer to Section 2.4.23 “ST,<hex16>,<hex16>,<hex16>,<hex16>” for com- mand ST and Table 2-8 for details. DS50002466C-page 38 2016-2018 Microchip Technology Inc. Document Outline Trademarks Table of Contents Preface Chapter 1. Overview 1.1 Introduction 1.2 Key Features 1.2.1 ASCII Command Interface 1.2.2 Transparent UART 1.2.3 Custom GATT Services 1.2.4 Embedded Scripting Feature 1.2.5 Remote Command Console 1.3 Command Mode and Data Mode Figure 1-1: Command Mode and Transparent UART (Data) mode 1.4 Accessing the RN4870/71 over UART Table 1-1: Default UART Settings 1.5 RN4870 PIO Control Lines Chapter 2. Command Reference 2.1 Introduction 2.2 Command Syntax 2.3 Set and Get Commands Table 2-1: Set and Get Commands Syntax Format 2.4 Set Commands 2.4.1 S-,<string> 2.4.2 S$,<char> 2.4.3 S%,<pre>,<post> 2.4.4 SA,<0-5 Table 2-2: Set I/O Capability 2.4.5 SB,<H8> Table 2-3: UART Baud Rate Settings 2.4.6 SC,<0-2> Table 2-4: CONNECTABLE AND NON-CONNECTABLE ADVERTIEMENT SETTINGS 2.4.7 SDA,<H16> 2.4.8 SDF,<text> 2.4.9 SDH,<text> 2.4.10 SDM,<text> 2.4.11 SDN,<text> 2.4.12 SDR,<text> 2.4.13 SDS,<text> 2.4.14 SF,1 2.4.15 SF,2 2.4.16 SGA,<0-5>/SGC,<0-5> Table 2-5: Typical Output Power values 2.4.17 SM,<1-3>,<hex16> 2.4.18 SN,<text> 2.4.19 SO,<0,1> 2.4.20 SP,<4/6 digit pin> 2.4.21 SR,<hex16> Table 2-6: Bitmap of Features 2.4.22 SS,<hex8> Table 2-7: Bitmap of Services 2.4.23 ST,<hex16>,<hex16>,<hex16>,<hex16> Table 2-8: Connection Parameters 2.4.24 STA,<hex16>,<hex16>,<hex16> 2.4.25 STB,<hex16> 2.4.26 SW,<hex8>,<hex8> Table 2-9: Pin Index and RN4870/71 Pins Table 2-10: Configurable Functions 2.5 Get Commands 2.5.1 GK 2.5.2 GNR 2.5.3 G<char> 2.6 Action Commands 2.6.1 +[,<text>] 2.6.2 $$$ 2.6.3 --- 2.6.4 !,<0,1> 2.6.5 @,<0-5> Table 2-11: analog Channels and Associated Pins 2.6.6 |I,<hex8> Table 2-12: Digital I/O Bitmap 2.6.7 |O,<hex8>,<hex8> 2.6.8 [,<1-2>,<0-3>,<hex16>,<hex16> Table 2-13: PWM Operation Selection Figure 2-1: Basic concept of PWM Operation 2.6.9 &,<MAC> 2.6.10 &C 2.6.11 &R 2.6.12 A[,<hex16>,<hex16>] 2.6.13 B 2.6.14 C 2.6.15 C,<0,1>,<address> 2.6.16 C<1-8> 2.6.17 D 2.6.18 F[,<hex16>,<hex16>] 2.6.19 I 2.6.20 IA,<hex8>,<Hex>/IB,<hex8>,<Hex>/IS,<hex8>,<Hex> NA,<hex8>,<Hex>/NB,<hex8>,<Hex>/NS,<hex8>,<Hex> Table 2-14: List of AD Types 2.6.21 JA,<0,1>,<MAC> 2.6.22 JB 2.6.23 JC 2.6.24 JD 2.6.25 K,1 2.6.26 M 2.6.27 O,0 2.6.28 R,1 2.6.29 T,<hex16>,<hex16>,<hex16>,<hex16> 2.6.30 U,<1-8,Z> 2.6.31 V 2.6.32 X 2.6.33 Y 2.6.34 Z 2.7 I2C Commands Table 2-15: I2C Peripheral Interface Table 2-16: I2C Commands 2.7.1 ]A Table 2-17: Clock values 2.7.2 ]Z 2.7.3 ]D 2.7.4 ]R 2.7.5 ]W 2.7.6 ]X 2.8 SPI Commands Table 2-18: SPI Peripheral Interface Table 2-19: SPI Contacts 2.8.1 {A Table 2-20: SPI Clock Polarity and Phase Settings Table 2-21: SPI Master Clock Rate Table 2-22: SPI Chip Select Pin 2.8.2 {Z 2.8.3 {X 2.8.4 }A Table 2-23: SPI Clock Polarity and Phase Settings Table 2-24: SPI Master Clock Rate 2.8.5 }Z 2.8.6 }R 2.8.7 }W 2.9 List Commands 2.9.1 LB 2.9.2 LC[,<P,UUID>] Figure 2-2: Listing Client Service and Characteristics 2.9.3 LS[,<P,UUID>] 2.9.4 LW 2.10 Service Configuration Commands 2.10.1 PC,<hex16/hex128>,<hex8>,<hex8> 2.10.2 PS,<hex16/hex128> 2.10.3 PZ 2.10.4 Defining Multiple Services 2.11 Characteristic Access Commands 2.11.1 Definition of Characteristic Access Commands Table 2-25: Format of GATT access commands 2.11.2 CHR 2.11.3 CHW 2.11.4 CI 2.11.5 SHR 2.11.6 SHW 2.12 Script Commands 2.12.1 WC 2.12.2 WP 2.12.3 WR[,<H6>] Table 2-26: Command WR Input Parameters and Associated Events 2.12.4 WW Chapter 3. Embedded Scripting Feature 3.1 Introduction 3.1.1 Script Overview 3.1.2 Event Driven Table 3-1: List of Events and Event Labels 3.1.3 Comments 3.1.4 Variables 3.1.5 Handle Association 3.1.6 Remote Function Call Chapter 4. Connection Examples 4.1 Connecting to RN4870 using SmartDiscover App Figure 4-1: Connect to the RN4870 module Figure 4-2: Service Discovery Figure 4-3: Characteristic Access 4.2 UART Transparent Connection Using SmartData Figure 4-4: Connect to RN4870 Figure 4-5: Data Exchange on SmartData APP Figure 4-6: Data Exchange on Terminal Emulator 4.3 Module-to-Module Connection Figure 4-7: Connecting two RN4870 modules Appendix A. Bluetooth Low Energy Fundamentals A.1 Introduction Table A-1: Characteristic Properties Figure A-1: GATT Service in RN4870 Appendix B. Transparent UART Service UUIDs B.1 Introduction Table B-1: Characteristic Properties Appendix C. Low-Power Operation C.1 Introduction Figure C-1: State Diagram Appendix D. Status Response Summary Quick Reference D.1 Introduction Table D-1: Status Messages Returned by RN4870 /71 Table D-2: Command Summary Quick Reference AMERICAS Corporate Office Atlanta Austin, TX Boston Chicago Dallas Detroit Houston, TX Indianapolis Los Angeles Raleigh, NC New York, NY San Jose, CA Canada - Toronto ASIA/PACIFIC Australia - Sydney China - Beijing China - Chengdu China - Chongqing China - Dongguan China - Guangzhou China - Hangzhou China - Hong Kong SAR China - Nanjing China - Qingdao China - Shanghai China - Shenyang China - Shenzhen China - Suzhou China - Wuhan China - Xian China - Xiamen China - Zhuhai ASIA/PACIFIC India - Bangalore India - New Delhi India - Pune Japan - Osaka Japan - Tokyo Korea - Daegu Korea - Seoul Malaysia - Kuala Lumpur Malaysia - Penang Philippines - Manila Singapore Taiwan - Hsin Chu Taiwan - Kaohsiung Taiwan - Taipei Thailand - Bangkok Vietnam - Ho Chi Minh EUROPE Austria - Wels Denmark - Copenhagen Finland - Espoo France - Paris Germany - Garching Germany - Haan Germany - Heilbronn Germany - Karlsruhe Germany - Munich Germany - Rosenheim Israel - Ra’anana Italy - Milan Italy - Padova Netherlands - Drunen Norway - Trondheim Poland - Warsaw Romania - Bucharest Spain - Madrid Sweden - Gothenberg Sweden - Stockholm UK - Wokingham Worldwide Sales and Service Worldwide Sales and Service