Summary of Contents for Microchip Technology RN4870
Page 1
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide 2016 Microchip Technology Inc. DS50002547A...
Page 2
Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design Germany II GmbH & Co. KG, a subsidiary of Microchip Technology and manufacture of development systems is ISO 9001:2000 certified. Inc., in other countries.
Page 3
For information regarding the exclusive, limited warranties applicable to Microchip products, please see Microchip’s standard terms and conditions of sale, which are printed on our sales documentation and available at www.microchip.com. Signed for and on behalf of Microchip Technology Inc. at Chandler, Arizona, USA. 2016 Microchip Technology Inc.
Page 4
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide NOTES: 2016 Microchip Technology Inc. DS50002547A-page 4...
3.2 Connecting the RN4870/71 PICtail/PICtail Plus Daughter Board to a Host PC ..................... 19 3.3 Changing Settings Using ASCII Commands ..........21 3.4 Connecting to the RN4870/71 Using SmartDiscover App ......22 3.5 Creating Custom GATT Services ..............24 3.6 Accessing GATT Service Using UART Commands and SmartDiscover App ..................
Page 6
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide B.4 RN4871 PICtail Schematic ................49 B.5 RN4871 PICtail BOM ................... 50 B.6 RN4870 Sensor Board Schematic ............... 52 B.7 RN4870 Sensor Board BOM ................ 52 Appendix C. Bluetooth Low Energy Primer C.1 GAP Roles: Peripheral and Central ............. 53 C.2 GATT Service: Client and Server ..............
GATT services, and how to read the Sensor Board Peripheral IO ports. • Chapter 4. “RN4870 Sensor Board” – This chapter describes the procedure to set up the RN4870 to use the various sensors on the Sensor board and also 2016 Microchip Technology Inc. DS50002547A-page 7...
Page 8
• Chapter 5. “PIC Configuration Library” – This chapter provides information on how to use the Configuration Library to configure the RN4870/71 module using a host MCU over UART. • Appendix A. “Updating PICtail Firmware” – This appendix shows the steps to update the firmware on the RN4870/71PICtail/PICtail Plus Daughter board.
Curly brackets and pipe Choice of mutually exclusive errorlevel {0|1} character: { | } arguments; an OR selection Ellipses... Replaces repeated text var_name [, var_name...] Represents code supplied by void main (void) user { ... 2016 Microchip Technology Inc. DS50002547A-page 9...
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide RECOMMENDED READING This user's guide describes how to use the RN4870/71 PICtail™/PICtail Plus Daughter Board. Other useful documents are listed below. The following Microchip documents are recommended as supplemental reference resources. ® RN4870/71 Bluetooth 4.2 Low Energy Module Data Sheet (DS50002489)
Technical support is available through the website at: http://www.microchip.com/support. DOCUMENT REVISION HISTORY Revision A (December 2016) This is the initial release of this document. 2016 Microchip Technology Inc. DS50002547A-page 11...
Page 12
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide NOTES: 2016 Microchip Technology Inc. DS50002547A-page 12...
The RN4870/71 PICtail/PICtail Plus Daughter board provides rapid prototyping and developing for Bluetooth data applications for Bluetooth Low Energy. It can be powered via USB host or through the Microchip PICtail Plus interface. The RN4870/71 PICtail/PICtail Plus Daughter board uses the RN4870/71 module, a fully certified Blue- tooth 4.2 Low Energy module.
• +2 dBm maximum TX power • On-Board Dual In-Line Package (DIP) switch block to set operating modes • PICtail Plus and PICtail interfaces to fully access RN4870 pins using the external PIC MCU • Embedded MCP2200 USB-UART converter to enable Application mode and pro- gramming interface to update firmware and configuration settings ...
Sensor Board RN4870 PICtail/PICtail PLUS DAUGHTER BOARD Figure 2-1 shows the interfaces of the RN4870 PICtail/PICtail Plus Daughter board. The PICtail board can be used in Standalone mode powered from either an external ® USB host, coin-cell battery, or from the PIC Explorer Development board.
Page 16
Configuration mode to update firmware or configuration settings 22. Ground Test Connector (J2) CN1, CN2 and CN3 are header pins to the RN4870 module pins. The headers are used either to connect the Sensor board to the PICtail board or as test points.
The RN4871 PICtail uses the RN4871 BLE module as shown in Figure 2-2. Due to its smaller footprint, the RN4871 has less IO pins than the full size RN4870 module. For ® the specific pinouts of the RN4870 and the RN4871 modules, refer to the “ Bluetooth 4.2 Low Energy Module Data Sheet”...
The Sensor board is an accessory designed for the RN4870 PICtail/PICtail Plus Daughter board to demonstrate digital and analog IO capabilities over Bluetooth Low Energy connections. In order to use the Sensor board with the RN4870, it must be con- figured as described in Chapter 4.
Chapter 3. Quick Start Guide OVERVIEW The simplest method to access the RN4870/71 is to connect it to a PC host that supports USB CDC virtual COM (serial) ports. Simple ASCII commands can be sent to the RN4870/71 module by using a terminal emulator application.
Page 20
COM PORT SETTINGS FOR TERMINAL EMULATOR 4. Enter Command mode by sending the command escape sequence $$$. Press- ing the dollar sign ($) three times puts the RN4870/71 into Command mode and CMD> prompt is displayed. When interacting directly with the RN4870/71 using terminal emulator, enable local echo feature on the RN4870/71.
RESULTS OF “D” TO DISPLAY BASIC CONFIGURATION CHANGING SETTINGS USING ASCII COMMANDS The RN4870/71 PICtail is shipped with a default configuration not including GATT ser- vices as noted by the result of the previous command D (display basic configuration). The services value is set to Services=00. The RN4870 module can be discovered ®...
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide 3. After any Set commands issued, the RN4870/71 module needs a device reboot (R,1) for the changes to take effect. To verify the configuration settings, perform the following steps: a) Type $$$ to enter Command mode...
Page 23
SmartDiscover App on an iOS device. FIGURE 3-7: SMART DISCOVER (iOS) 4. Verify that the RN4870/71 device name, BLE-b1b0, is displayed. In this exam- ple, the device name is BLE-C071 as shown in Figure 3-7.
The cut and paste method saves time and minimizes keyboard entry errors. The configuration text files are included in the RN4870 Sensor board Support package that can be downloaded from the product web page at www.microchip.com/RN4870.
1. To write a value to the GATT Server characteristic C501, use the Server Handle Write (SHW) and the Server Handle Read (SHR) commands with reference 0072 as first parameter, following by hex-byte values as shown in Figure 3-11. 2016 Microchip Technology Inc. DS50002547A-page 25...
Page 26
GATT characteristic C501. In steps 1 and 2, tap on the name of your device (BLE-C071 >), on the UUID (BF3FBD80063F11E59E690002A5D5C501 and on Read in step 3. The charac- teristic value is read from the RN4870/71 into the Smart Discover App. FIGURE 3-12: USING SMARTDISCOVER TO READ GATT CHARACTERISTIC VALUE ...
• Type $$$ to enter Command mode • Enter SF,1 and verify that the module reboots after the command is entered. 3. Type the following sequence of commands to set the RN4870 IO pin into the con- figuration as illustrated in Figure 3-13: •...
Page 28
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide FIGURE 3-13: RN4870 PINS USED BY SENSOR BOARD INTERFACE 4. After the IO ports are configured and the module is rebooted, perform the com- mands shown in Figure 3-14 to read and write peripheral IO.
OVERVIEW The RN4870 must be configured to enable the Sensor Board peripherals, and to enable the BLESensor App to communicate with the RN4870. The following is the con- figuration procedure: 1. Configure Peripheral IO port to sensors using command SW.
RN4870 MODULE SETTINGS CONFIGURATION SENSOR BOARD GATT SERVICE The data from the RN4870 peripheral IO are stored in the characteristics of a custom GATT service accessed by the Sensor Board BLE Client App. To create the Sensor Board GATT Service, enter the following commands while in Command mode: 1.
Page 31
SENSOR BOARD GATT SERVICE DECLARED IN RN4870 Figure 4-2 illustrates that a custom GATT service has been created in the RN4870 module. A 16-bit handle is assigned to each characteristic where each characteristic has a value in the handle and a property handle. The characteristic value and the prop- erties are accessed by a short and more efficient 16-bit handle instead of the 128-bit UUID value.
Press OK to load the script into the RN4870. e) After the script is pasted into the RN4870, exit Script Entry mode by pressing the <ESC> key. An AOK response is sent to the terminal. The script entry is...
Page 33
FIGURE 4-4: COMPLETED SENSOR BOARD SCRIPT Enter command R,1 to reboot the RN4870 module. After the reboot, the Sensor board is ready to use. The script event handlers can be seen on the TeraTerm display as shown in Figure 4-5.
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide BLESENSORAPP SMARTPHONE APP The RN4870 Sensor board is a BLE Peripheral that advertises a GATT service to BLE Central devices. In this demonstration, the BLE Central device is a smartphone appli- cation named BLESensorApp. It is available for iOS and Android platforms via iTunes AppSTORE, and Google Play Store, respectively.
Page 35
In the Sensor board demo, slider control is used on the App to select a blink rate value. The value is written to the GATT characteristic in the RN4870. The sensor script monitors the Characteristic for incoming data then extracts the value which is subse- quently written to the Pulse-With Modulation (PWM) output peripheral to control LED blink rate.
(SW7 must in be in position 1: Application mode) 3. Connect the RN4870 to the host PC using the micro USB cable and verify that LED1 blinks blue with long interval. 4. Wait for the RN4870 board to successfully enumerate as a Serial Port device.
Page 37
7. Ensure that the RN4870 board is still connected to the Windows PC and suc- cessfully enumerated. Click Scan button to scan for all the UART COM ports available on the Windows PC. Note: Ensure that the COM port on which the RN4870 board is enumerated is not opened by another application like a Serial Terminal application.
Page 38
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide FIGURE 4-11: CONFIGURATION UTILITY: CONFIGURING MODULE 10. After the provisioning process is completed, an information dialog window pops up to inform about the successful provisioning of the RN4870 module. Refer to Figure 4-12. Note: After the provisioning is successful, the RN4870 automatically reboots and retains the provisioned configuration.
The RN4870/71 module uses the UART interface for configuration and data transfer. The RN4870/71 Configuration and Events are defined as Command and Response protocol packets. A Command packet is sent to the RN4870/71 over UART to update a parameter. A Response packet is received from the RN4870/71 over UART for the command issued.
Page 40
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide 3. Optionally, a debug UART port can be connected to a PC terminal emulator program. Note: On the Explorer 16 Development board, the debug UART is available on the DB9 UART serial connector P1. On the PIC18 Explorer board, the debug UART needs to be manually tapped from pins RG1/TX2 and RG2/RX2 on the J5 header using external wiring.
Page 41
“ Bluetooth Low Energy Module User’s Guide” (DS50002466). 7. Once connected, the data can be transmitted from the RN4870/71 through the debug UART port to the BtChat app over Bluetooth link. 8. Enable Show Rx Text option in the BtChat app setting. The BtChat app can resend data to the RN4870/71 that is later received through the debug UART.
Page 42
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide NOTES: 2016 Microchip Technology Inc. DS50002547A-page 42...
Appendix A. Updating PICtail Firmware OVERVIEW Firmware for the RN4870/71 PICtail can be updated using a PC Tool isupdate.exe over the USB port. The latest RN4870/71 firmware images and the isupdate.exe tool are available from the product web page at www.microchip.com/RN4870.
Page 44
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide 6. Click the Connect button and verify the “Port connect -> COMxx” is displayed in the text box. 7. Verify firmware update is successfully completed. The “End of Write Memory” message is displayed.
RN4871 PICtail SCHEMATIC Figure B-2 shows the schematic for the RN4871 PICtail™/PICtail Plus Daughter board. FIGURE B-2: RN4871 PICtail SCHEMATIC USB to UART Configuration USB_5V 300R Power Source Option MODE 47uF Test Mode 4.7k Micro USB DIP 1 SPST TANT-C APP Mode 0603 0805...
GATT client to GATT server Read 0x02 Read value of characteristic. Value is sent from GATT server to GATT client Broadcast 0x01 Broadcast value of characteristic Note 1: These features are supported in future firmware releases 2016 Microchip Technology Inc. DS50002547A-page 53...
Page 54
GATT client using Write, Read, Indication and Notifications. Write-REQ enables the GATT client to update characteristic values on the Peripheral's GATT server. The write requests can be performed using RN4870 CHW and CUW com- mands. Refer to Section 3.6 “Accessing GATT Service Using UART Commands and SmartDiscover App”...
This appendix provides an example for configuration commands to use all the sensors in the Sensor board in a GATT service. • RN4870 Module Settings • RN4870 Sensor Board GATT Service • Sensor Board Script D.1.1 RN4870 Module Settings S-,RN4870...
Page 56
RN4870/71 PICtail™/PICtail Plus Daughter Board User’s Guide D.1.3 Sensor Board Script To configure the Sensor board, enter the following sequence of commands: @PW_ON IA,Z SM,2,0000 SM,1,0002 %0078=?FUNC1 ?FUNC1 [,1,1,$PM1,$PM2 @DISCON SM,1,0000 SM,2,0000 SM,3,0000 @CONN SM,1,0000 SM,2,0000 SM,3,001A @TMR1 IA,Z IA,FF,CD00FE14AD11CF40063F11E5BE3E0002A5D5C51B000C000D...
Need help?
Do you have a question about the RN4870 and is the answer not in the manual?
Questions and answers