Smartphone Basic Demo (Transparent UART)

Last modified by Microchip on 2023/11/10 11:11

Objective

This tutorial takes you through the steps needed to establish a transparent UART connection using the Bluetooth Smart Data (SmartData) app.

Reference Materials

Procedure

Jumpers

Make sure the following connections on the RN4870 PICtail are enabled.

J3: USB-UART Interface Connection

This jumper bank connects the RX, TX, RTS, and CTS signals from the module to the USB. Put the jumpers on the bottom two (TX and RX). The top two can be added based on your flow control preferences.

Board View:  USB-UART Interface Connection

JP8: P0_2 LED Display

Connect this one if you want to see the LED indication from the module, it is connected by default.

Board View:  Connect JP8 if you want to see the LED indication from the module

J1: Power Source Connector

This lab uses CoolTerm, so make sure to connect the middle jumper labeled USB.

Board View:  Power Source Connector


Connect RN4870 PICtail Board to PC

Connect the RN4870 PICtail to the PC via supplied USB cable.

Board View:  RN4870 PICtail connected to the PC via USB cable


Verify COM Port

Open the Device Manager window by going to Start Menu > Control Panel > Hardware and Sound > Device Manager. Once open, check which COM port has been assigned to the RN4870 PICtail board.

Device Manager showing which COM Port has been assigned to the RN4870 PICtail board


Start a CoolTerm Connection

Launch CoolTerm and establish a connection with the following settings (your COM port might be different).

CoolTerm Connection window showing 15200 baudrate


Enable Transparent Service

Enter the following commands into your CoolTerm window:

$      // Enter Command Mode
+        // Turn Local Echo on
SS,C0    // Support Device Info and UART Transparent services  
R,1      // Reboot device for configuration to take effect

SmartData App

On your Apple® device, go to the App Store®​​​​​, and install the SmartData app by Microchip Technology Inc.

SmartData app screen


Launch the SmartData App

After you open the SmartData app on your smartphone, it will immediately scan for Bluetooth devices nearby. The default name for the RN4870 module, RN_BLE, should show up. Tap on it to connect to your RN4870 module.

Smart Data app scans for Bluetooth devices nearby

On the CoolTerm window, you will see the status message %CONNECT,1,<MAC>% returned by the RN4870 UART, indicating a connection has been established. The <MAC> address is the address of the remote device that initiated the connection. Next to it, you will also see the %STREAM_OPEN% message, indicating that the UART Transparent data pipe has been established. Once connected to another device, the RN4870/71 automatically enters Data mode if the UART Transparent feature is enabled.

CoolTerm window indicating a connection has been established

Another message you might see is the %CONN_PARAM,<Interval>,<Latency>,<Timeout>% status message. This shows the connection interval, slave latency, and supervision timeout parameters for the existing connection.


Send Data

You can now start exchanging data. Once you have typed your message, (Hello World!), on the app, press the Send button to transfer data from SmartData app to the RN4870 module. The message is received and printed on the serial terminal of the RN4870 UART (CoolTerm window).

CoolTerm device echo

Type another message, (How are you?), into the serial terminal of the RN4870 and you will see it is received and printed on the Receive view of the SmartData app.


Conclusions

In this lab, you:

  • Added the Transparent UART Service to your RN4870 module.
  • Sent and received data using Microchip's Transparent UART Service.

Back to Top