renesas bluetooth mcu (rl78/g1d) - application … synergy platform renesas bluetooth mcu (rl78/g1d)...

21
Application Note R12AN0056EU0112 Rev.1.12 Page 1 of 19 Feb 22, 2017 Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D) Introduction The purpose of this document is to assist you with understanding the capabilities of the Renesas Synergy Platform- based BLE application, using the Renesas BLE MCU (RL78/G1D), on SK-S7G2 and PK-S5D9 kits. This document also describes the application and implementation details on the SK-S7G2 and PK-S5D9 kit, using the SSP (Synergy Software Package). This document describes how to import the project, so that you can recreate the application with the e 2 studio Integrated Solutions Development Environment (ISDE). This application note also details the Renesas Bluetooth Low Energy (BLE) device capabilities using Renesas Synergy™ starter kit SK-S7G2 and PK-S5D9, with the companion application (app) running on smart phone devices (Android/iPhone). You can connect and pair to the Renesas BLE using the smartphone app and verify the transmitted sensor values on the smartphone app. You can also control the on/off of SK- S7G2 and PK-S5D9 LEDs from the smart phone app. Target Device and Required Hardware Renesas Synergy starter kit SK-S7G2 v2.0 and above Renesas Synergy starter kit PK-S5D9 v1.0 and above Digilent ® PmodACL2 Accelerometer iOS or Android based Smart Devices (Phone/Tab). Minimum PC Requirements Microsoft ® Windows ® 7 Intel ® Core family processor running at 2.0 GHz or higher (or equivalent processor) 8 GB memory 250 GB hard disk or SSD USB 2.0 Internet connection. Required Resources The example application targets Renesas Synergy S7G2/S5D9 devices. To build and run the application, you will need: A Renesas Synergy SK-S7G2 board A Renesas Synergy PK-S7G2 board e 2 studio ISDE v5.3.1 or greater or IAR EW for Synergy v7.71.1 or greater Synergy Software Package (SSP) 1.2.0 or Synergy Standalone configurator (SSC) 5.3.1 You can download the required Renesas software from the Renesas Synergy Gallery (https://synergygallery.renesas.com). Purpose This document demonstrates how to exercise the RL78/G1D BLE interface on SK-S7G2, PK-S5D9 Renesas Synergy Development Kits through an example application. Prerequisites and Intended Audience As the user of this application note, you are assumed to have some experience with the Renesas e 2 studio ISDE and SSP. For example, before you perform the procedure in this application note, you should follow the procedure in your board’s Quick Start Guide to build and run the Blinky project. By doing so, you will become familiar with e 2 studio and the SSP, and ensure that the debug connection to your board is functioning properly. In addition, you are also assumed to have some knowledge on the Bluetooth device and stack and its communication protocols. The intended audience are users who want to develop applications with BLE interface using the S7G2, S5D9 Synergy MCUs using Renesas BLE. R12AN0056EU0112 Rev.1.12 Feb 22, 2017

Upload: doantuong

Post on 24-May-2018

273 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Application Note

R12AN0056EU0112 Rev.1.12 Page 1 of 19 Feb 22, 2017

Renesas Synergy™ Platform

Renesas Bluetooth MCU (RL78/G1D) Introduction The purpose of this document is to assist you with understanding the capabilities of the Renesas Synergy Platform-based BLE application, using the Renesas BLE MCU (RL78/G1D), on SK-S7G2 and PK-S5D9 kits. This document also describes the application and implementation details on the SK-S7G2 and PK-S5D9 kit, using the SSP (Synergy Software Package).

This document describes how to import the project, so that you can recreate the application with the e2 studio Integrated Solutions Development Environment (ISDE). This application note also details the Renesas Bluetooth Low Energy (BLE) device capabilities using Renesas Synergy™ starter kit SK-S7G2 and PK-S5D9, with the companion application (app) running on smart phone devices (Android/iPhone). You can connect and pair to the Renesas BLE using the smartphone app and verify the transmitted sensor values on the smartphone app. You can also control the on/off of SK-S7G2 and PK-S5D9 LEDs from the smart phone app.

Target Device and Required Hardware • Renesas Synergy™ starter kit SK-S7G2 v2.0 and above • Renesas Synergy™ starter kit PK-S5D9 v1.0 and above • Digilent® PmodACL2 Accelerometer • iOS or Android based Smart Devices (Phone/Tab).

Minimum PC Requirements • Microsoft® Windows® 7 • Intel® Core™ family processor running at 2.0 GHz or higher (or equivalent processor) • 8 GB memory • 250 GB hard disk or SSD • USB 2.0 • Internet connection.

Required Resources The example application targets Renesas Synergy S7G2/S5D9 devices. To build and run the application, you will need:

• A Renesas Synergy SK-S7G2 board • A Renesas Synergy PK-S7G2 board • e2 studio ISDE v5.3.1 or greater or IAR EW for Synergy v7.71.1 or greater • Synergy Software Package (SSP) 1.2.0 or Synergy Standalone configurator (SSC) 5.3.1 You can download the required Renesas software from the Renesas Synergy Gallery (https://synergygallery.renesas.com).

Purpose This document demonstrates how to exercise the RL78/G1D BLE interface on SK-S7G2, PK-S5D9 Renesas Synergy Development Kits through an example application.

Prerequisites and Intended Audience As the user of this application note, you are assumed to have some experience with the Renesas e2 studio ISDE and SSP. For example, before you perform the procedure in this application note, you should follow the procedure in your board’s Quick Start Guide to build and run the Blinky project. By doing so, you will become familiar with e2 studio and the SSP, and ensure that the debug connection to your board is functioning properly.

In addition, you are also assumed to have some knowledge on the Bluetooth device and stack and its communication protocols.

The intended audience are users who want to develop applications with BLE interface using the S7G2, S5D9 Synergy MCUs using Renesas BLE.

R12AN0056EU0112 Rev.1.12

Feb 22, 2017

Page 2: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017

Contents

1. BLE Application Overview........................................................................................................ 3

2. Application Architecture ........................................................................................................... 3

3. Memory Usage Details ............................................................................................................ 6

4. Hardware Details ..................................................................................................................... 6 4.1 Application-specific Key Components ..................................................................................................... 6 4.2 Hardware Interfaces ................................................................................................................................ 6 4.2.1 JLink interface ....................................................................................................................................... 6 4.2.2 LED interface ......................................................................................................................................... 7 4.2.3 Push button interface ............................................................................................................................ 7 4.2.4 PMOD interface for accelerometer ........................................................................................................ 8 4.2.5 Capacitive touch sensor interface ......................................................................................................... 8 4.2.6 USB host interface ................................................................................................................................ 9 4.3 Connecting to the Board .......................................................................................................................... 9

5. RL78/G1D Device programming .............................................................................................. 9

6. Smart phone App ..................................................................................................................... 9 6.1 Android Devices ...................................................................................................................................... 9 6.2 iOS Devices ............................................................................................................................................. 9

7. Importing and Building the Project ........................................................................................... 9

8. Running the Application ........................................................................................................... 9

9. Summary ............................................................................................................................... 10

10. References ............................................................................................................................ 11

11. Limitations ............................................................................................................................. 11

12. Workarounds ......................................................................................................................... 11

13. Appendix ............................................................................................................................... 12 13.1 Appendix 1: Programming the RL78/G1D with Firmware ..................................................................... 12 13.2 Appendix 2: Installing the Android App on the Android Devices ........................................................... 14 13.2.1 Setting up your Android device ........................................................................................................... 14 13.2.2 Setting up your Android device ........................................................................................................... 15 13.3 Appendix 3: Installing and running the Light Blue Generic App on the iOS Devices ........................... 16 13.3.1 Downloading an app ............................................................................................................................ 16 13.3.2 Running the application to discover the Renesas BLE ....................................................................... 16

Page 3: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 3 of 19 Feb 22, 2017

1. BLE Application Overview This BLE application example shows a typical IoT application using different sensors, Bluetooth LE, the Renesas Synergy Platform, and a smartphone application (app). Data acquired from an accelerometer, touch sensor, and temperature sensor, are processed and streamed through the BLE to a smartphone running a companion application. Additionally, the smartphone can also send commands to turn on and off the LEDs on the Renesas Synergy Platform development board. Figure 1.1 shows the overview of the example application.

Figure 1.1 Main components The BLE application uses the Renesas Synergy starter kit SK-S7G2, PK-S5D9 with RL78/G1D BLE. The sensors connected are the accelerometer (Diligent PmodACL2 on PMODA), CPU core temperature sensor, capacitive touch sensor, push button switch, and status LEDs. In this application, the custom BLE profile is used along with GATT to communicate between RL78/G1D and the smartphone app.

2. Application Architecture The high-level application architecture is shown in the figure below. The main software components of the applications are the application threads, BLE app thread, BLE host thread and the interface to the RL78/G1D using the SCPS, GATT and RSCIP.

The application threads, essentially the collector threads, process the events and the sensor data from the sensor, massage it to the correct format, and send to the dispatcher thread using the ThreadX message queues. The dispatcher thread determines and delivers the data to the BLE service for which it is intended.

The application receiver thread receives any service specific data coming from the remote, such as LED control from companion smart phone app, and pass it on to the LED utility handler to turn On/Off the LEDS.

The BLE app thread handles all the application commands relating to the GAP (Generic Access Profile), SM (Security Manager), SCPS (Sample Custom profile Server) and directs to the related handlers. GAP essentially handles the advertisement connectivity to the clients. GATT profile defines the way that two Bluetooth Low Energy devices transfer data back and forth using concepts called Services and Characteristics. It uses a generic data protocol called the Attribute Protocol (ATT). SCPS handles the request coming from the remote clients. Based on the request, it services the requested events. In this application, the accelerometer, temperature, touch sensor data, including the push button events are sent as the notification events as part of the BLE characteristics.

The BLE host thread essentially handles the events data coming over the UART using the RSCIP (Renesas Serial Communication Interface Protocol) and passes it on to the GATT server and later on to the SCPS.

Page 4: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 4 of 19 Feb 22, 2017

Figure 2.1 BLE application main components The LCD GUI thread is used to create the LCD driver functionality in the application. It exposes the utility functions for writing onto the LCD, which are directly called from the application and the SCPS to update the status of the connectivity and the events received and sent from the application. This can be used for debugging purposes during the development.

Figure 2.1 summarizes all the components/resources required for the embedded application to develop in the Synergy Integrated Solution Development Environment (ISDE). The application design on Synergy can be further broken down, as shown in Figure 2.2, where the details of the driver, framework, and the ThreadX resources are shown.

Figure 2.2 SSP level overview of the application and SSP components

Page 5: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 5 of 19 Feb 22, 2017

Figure 2.3 Overview of Synergy MCU and RL78/G1D BLE in modem mode In this application, RL78/G1D operates in modem mode where two MCUs are used. The MCU (Synergy MCU), which is also called the Host MCU, runs the application. The MCU (RL78/G1D), which runs the BLE, and is called the BLE MCU is responsible for the BLE stack, Link Layer, Physical Layer and Radio control. The two MCUs communicate using a UART interface. For more details on the RL78/G1D, see the RL78/G1D reference documents listed in the References section of this document.

From a functionality perspective, the embedded application running on the SK-S7G2 or PK-S5D9 acts a server in a client-server architecture, providing the client (smartphone example application) with the accelerometer, touch sensor, temperature, and other data. The server provides this information following BLE’s Generic Attribute Profile (GATT), which is used to present the client with the list and type of information and services available.

Figure 2.4 BLE client/server architecture

Page 6: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 6 of 19 Feb 22, 2017

3. Memory Usage Details

4. Hardware Details 4.1 Application-specific Key Components

Figure 4.1 SK-S7G2/PK-S5D9 Board layout

4.2 Hardware Interfaces 4.2.1 JLink interface This connector is used for powering the board, downloading the image to the board, and debugging the code.

Page 7: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 7 of 19 Feb 22, 2017

Figure 4.2 JLink hardware interface on SK-S7G2/PK-S5D9 board

4.2.2 LED interface The status LEDs shown in the figure are the user LEDs, which are used by the application. Pressing the LED button from the smartphone changes the state of the LED from on to off and vice versa.

The pin details for the LEDs are shown in Figure 4.3. You need to make sure that these pins are configured as GPIO and output mode, to drive the LEDs.

Figure 4.3 LED interface on SK-S7G2/PK-S5D9 board

4.2.3 Push button interface These push buttons shown in Figure 4.4 are used for keying in the user input. In the BLE application, pressing this button displays the status of the switch on the smartphone app.

Figure 4.4 Push buttons The pin details of the switch connected to the MCU and the associated IRQ are shown in Figure 4.5.

Page 8: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 8 of 19 Feb 22, 2017

Figure 4.5 Push button hardware interface on SK-S7G2/PK-S5D9 board

4.2.4 PMOD interface for accelerometer This Accelerometer PmodACL2 from Digilent is connected to the PMODA. You need to make sure that the 3V3 is selected on J12. The pin details of the PMODA are shown in Figure 4.6. For more information on the PmodACL2, refer to the Datasheet for the PmodACL2 listed in the References section.

Figure 4.6 Accelerometer PMOD module hardware interface on SK-S7G2/PK-S5D9 board

4.2.5 Capacitive touch sensor interface This cap touch interface available on the SK-S7G2 primarily has a touch button and a touch slider. By pressing the touch buttons 1 or 2, you can key in the required selection. By sliding the touch slider you can control the input for desired level such as low to high. In this application, it is just used to generate some data and the data is displayed raw on the smartphone. If the Switch 1 pressed, it generates pressed and depressed status as 11 and 10. For the switch 2, the pressed and depressed status are shown as 21 or 20. Touch slider data Varies from 00 to 512 when it is moved from -ve to +ve.

Figure 4.7 Touch sensor hardware interface on SK-S7G2/PK-S5D9 board

Note: Currently the Touch button and Slider functionality is not available.

Page 9: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 9 of 19 Feb 22, 2017

4.2.6 USB host interface This interface is used mainly to connect any USB mass storage devices. In the BLE application, this is used for USB flash drive, wherein the firmware image for the RL78/G1D is stored, and its associated programmer image running on the SK-S7G2, PK-S5D9 programs the firmware image (custom profile) on to the RL78/G1D.

Figure 4.8 USB host interface on SK-S7G2/PK-S5D9 board

4.3 Connecting to the Board Connect the micro USB cable provided as part of the board to J19 (DEBUG_USB), and connect the other end to the PC where the e2 studio or IAR EW is running. This powers up the board, and gets it ready for download and debugging.

Note: For more details, follow the procedure in the SK-S7G2, PK-S5D9 target board Quick Start Guide to set up the J-link debugger connection from your PC to the JTAG connector on the target board, and power-up the board.

5. RL78/G1D Device ProgrammingIn order to run the RL78/G1D BLE on SK-S7G2 and PK-D5D9, you need to program the firmware on the RL78/G1D device. Generic profile images are programmed by manufacturing. In order to run the required or specific profiles on RL78/G1D, refer to Appendix 1: Programming the RL78/G1D with Firmware, for details.

6. Smart phone App6.1 Android Devices The Android app is provided in the application bundle. You need to download the app and install it on the Android phone/tablet devices. See Appendix 2: Installing the Android App on the Android Devices, for installation details.

6.2 iOS Devices At the time of writing this App Note, custom apps are not available for iOS devices to support the RL78/G1D based Renesas BLE application. Support will be available in the upcoming releases. However, in order to test this application, you can download the generic app “Light Blue”. More details on using “Light Blue” app are provided in Appendix 3: Installing and running the Light Blue Generic App on the iOS Devices.

7. Importing and Building the ProjectFollow the procedure in the Synergy Project Import Guide (r11an0023eu0116_synergy_ssp.pdf) to import the project into the e2 studio ISDE, and to build and debug the project. When prompted to select the debug configuration, select Renesas_Ble_Demo Debug (under Renesas GDB Hardware Debugging).

8. Running the ApplicationRunning the application requires:

1. Programming the custom profile firmware on to the RL78/G1D Device present on SK-S7G2, PK-S5D9.2. Powering up the development board with the embedded application running on it.3. Enabling Bluetooth interface in the smart phone device.4. Launching the application in the smart phone device.5. Pressing the Scan button on the application to select the Synergy_BLE and establish a connection with the

development kit.

To run the application, click the Run button from the e2 studio. When the application is running, it displays the initial connectivity events and status on the LCD screen of the SK-S7G2, PK-S5D9. Once the pairing is done, the development kit sensor (accelerometer, temperature, touch slider) data is seen on the LCD. In addition, the push button and LED status are also displayed on the LCD.

Page 10: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 10 of 19 Feb 22, 2017

On the smartphone application, the same sensor data, which is transmitted through the RL78/G1D BLE using the custom profile, can be seen.

Figure 8.1 Smartphone App Screens Figure 8.2 shows the overview of the application running between SK-S7G2, PK-S5D9 board and smart phone app.

Figure 8.2 Synergy BLE application overview Once connected, sensor data is streamed to the smartphone application and presented on the main screen. Touching the Cap Touch sensor mounted on the kit changes the value labeled Sensor on the smartphone application. The temperature reading on the smartphone application is updated with the reading of the on-chip temperature sensor. Pressing the user buttons S4, S5 on the development board causes the Button Status labels to light up on the smart phone application. Moving the development kit causes the X, Y and Z-axis accelerometer readings to vary on the smart phone application. While the LED1, LED2, LED3 buttons on the application are pressed, the on-board user LED1, LED2, LED3 light up.

9. Summary The Renesas Synergy Platform is used as the foundation for a BLE application that communicates sensor data to smart devices.

The Synergy Software Package (SSP) provides core modules including ThreadX integration for building the application and the Renesas e2 studio ISDE provides a GUI-based development environment for configuring the SSP modules and developing the application.

Page 11: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 11 of 19 Feb 22, 2017

10. References • Bluetooth® Low Energy Protocol Stack Sample Application "r01an1375ej0118_g1dsmplpan" • Bluetooth® Low Energy Protocol Stack rBLE Command Specification "r01an1376ej0116_g1drblecom" • Bluetooth® Low Energy Protocol Stack API Reference Manual: Basics "r01uw0088ej0117_g1drm-main" • SK-S7G2 v2.0 User Manual: Hardware • SK-S7G2 Schematics • PK-S5D9 v2.0 User Manual: Hardware • PK-S5D9 Schematics • Renesas Synergy Software Package Datasheet. • PmodACL2 Accelerometer Datasheet • http://www.bluetooth.org/Technical/Specifications/adopted.htm.

11. Limitations This application only works with a single client connecting simultaneously to the server.

In the preliminary version of this release, you may experience connectivity issues. You are advised to restart the Android app, and/or the SK-S7G2, PK-S5D9 kits.

In Android and iOS, devices maintain the cache of the previously connected profile and its associated service and characteristics. When running this application, you are advised to clear the cache by turning off and then back on, through the setting menu of the Android and iOS devices.

In this application, the speed of the UART between Synergy and RL78/G1D is set to 19200 bps.

While programming the board with USB flash drive, certain drives may not be detected.

12. Workarounds If the advertisement of the device is not seen on the app running on smart phone, recheck the hardware connection to the board. Restart the BLE application and see the event/status changing on the LCD screen.

The advertised devices are also seen on generic apps such as “Light Blue” on the iPhone, and BLE Scanner on the Android to make sure that the SK-S7G2, PK-S5D9 board is advertising.

When powering up the board for the first time, the board address is written to the flash area of the RL78/G1D. In addition, this needs a reset in order to start the application. You are advised to recycle the power.

If the USB drive is not detected, make sure that the USB drive is formatted for FAT16/FAT32 file systems.

Page 12: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 12 of 19 Feb 22, 2017

13. Appendix 13.1 Appendix 1: Programming the RL78/G1D with Firmware

Figure 13.1 J-link Commander launch

Figure 13.2 Programming the programmer.hex image to SK-S7G2 board using J-Link

Page 13: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 13 of 19 Feb 22, 2017

Figure 13.3 Programming the programmer.hex image to PK-S5D9 board using J-Link

Download the programmer.hex image file from the bundle to the SK-S7G2, PK-S5D9 board using the J-Link commander as shown in Figure 13.2 and Figure 13.3.

Copy the RL78-firmware.hex to the flash drive. Also, insert the flash drive to the USH_H connector of the SK-S7G2, PK-S5D9 board.

Reset the SK-S7G2, PK-S5D9 board. The programmer application runs on the SK-S7G2, PK-S5D9 and looks for the USB flash drive. Once it detects the flash drive, select the firmware.hex file to program on to the RL78/G1D using the push button on the board.

Follow the steps that appear on the LCD screen until the image is programmed on the RL78/G1D using SK-S7G2, PK-S5D9 kit. The snapshots of the programming steps are as shown in the LCD screen shots.

Page 14: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 14 of 19 Feb 22, 2017

Figure 13.4 LCD Screen shots for Programming the RL78/G1D firmware using SK-S7G2 or PK-S5D9 The RL78/G1D is now ready to run the custom profile for BLE application.

13.2 Appendix 2: Installing the Android App on Android Devices 13.2.1 Setting up your Android device From your smartphone or tablet running Android 4.0 or higher, go to Settings, scroll down to Security, and select Unknown sources. Selecting this option allows you to install apps outside of the Google Play store. Depending on your device, you can also choose to be warned before installing harmful apps. This can be enabled by selecting the Verify apps option in the Security settings.

Page 15: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 15 of 19 Feb 22, 2017

Figure 13.5 Android App installation settings

The next step is to find an Android package file, also known as an APK, which is the way Android apps are distributed and installed.

To set up your Android device:

1. Connect the Android device to PC. The Android device is detected as the external drive for the computer.2. Copy the Renesas_BLE.apk file distributed as part of the bundle to the android device “download folder”.3. From the android phone, double click the Renesas_BLE.apk file. The application starts installing on to the

Android device. Once installed, the smart device is ready for the Renesas BLE app. The app appears as BLEDemo. The snapshot of the installed app is shown in Figure 13.6.

Figure 13.6 Snapshot of the installed Android app

Page 16: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 16 of 19 Feb 22, 2017

13.3 Appendix 3: Installing and running the Light Blue Generic App on the iOS Devices

13.3.1 Downloading an app To download an app:

1. From your smartphone or tablet device running iOS, go to the App store and search for “Light Blue” app. 2. Download the app to you smart device. 3. Install the app. Once the proper installation is done, this app is ready for scanning the BLE devices, which are in

advertisement mode. 13.3.2 Running the application to discover the Renesas BLE To do this:

1. Launch the Light Blue application. The app automatically lists the scanned peripherals nearby. 2. Connect to the Renesas-BLE. Once the connectivity is made, it is paired. You can see the characteristics listed as

part of the advertisement as shown in Figure 13.7 to Figure 13.11. You will notice that Renesas-BLE has one service along with one “write” characteristics and four “Notify” characteristics.

3. When the write characteristics is selected, it takes you to new screen where you can see Write new value. 4. When Write new value is selected, you can write an 8-bit value to turn the LED on or off.

Value 0x01 turns on the LED1, 0x02 turns on the LED2, 0x04 turns on the LED3, and so on. Similarly clearing the bit corresponding to the LED turns off the LED.

5. When the characteristic Read Notify is selected, it takes you to a different screen where you can see Listen for notification.

6. When Listen for notification is selected, you can see the notifications coming from the SK-S7G2- RL78/G1D or PK-S5D9-RL78/G1D. There are four notifications each for Push button, Temperature, Touch sensor, and Accelerometer. The data being received using Light Blue app is raw data, meant only to demonstrate the BLE application.

Figure 13.7 to Figure 13.11 show the screenshots of the Light Blue app.

Figure 13.7 Connecting to RL78/G1D on SK-S7G2, PK-S5D9

Page 17: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 17 of 19 Feb 22, 2017

Figure 13.8 Pairing the devices

Figure 13.9 Write operation to turn the LED on and off

Figure 13.10 Enabling notification

Page 18: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 18 of 19 Feb 22, 2017

Figure 13.11 Received notification with data

Page 19: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Renesas Synergy™ Platform Renesas Bluetooth MCU (RL78/G1D)

R12AN0056EU0112 Rev.1.12 Page 19 of 19 Feb 22, 2017

Website and Support Support: https://synergygallery.renesas.com/support

Technical Contact Details:

• America: https://renesas.zendesk.com/anonymous_requests/new • Europe: https://www.renesas.com/en-eu/support/contact.html • Japan: https://www.renesas.com/ja-jp/support/contact.html

All trademarks and registered trademarks are the property of their respective owners.

Page 20: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Revision History

Rev. Date Description Page Summary

1.10 Oct 19, 2016 - Updated for SSP 1.2.0-b.1, limitations, and workarounds 1.11 Nov 30, 2016 - Added support for IAR EW 1.12 Feb 22, 2017 - Updated for SSP 1.2.0

Page 21: Renesas Bluetooth MCU (RL78/G1D) - Application … Synergy Platform Renesas Bluetooth MCU (RL78/G1D) R12AN0056EU0112 Rev.1.12 Page 2 of 19 Feb 22, 2017 Contents 1. BLE Application

Notice1. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples. You are fully responsible for

the incorporation or any other use of the circuits, software, and information in the design of your product or system. Renesas Electronics disclaims any and all liability for any losses and damages incurred by

you or third parties arising from the use of these circuits, software, or information.

2. Renesas Electronics hereby expressly disclaims any warranties against and liability for infringement or any other disputes involving patents, copyrights, or other intellectual property rights of third parties, by or

arising from the use of Renesas Electronics products or technical information described in this document, including but not limited to, the product data, drawing, chart, program, algorithm, application

examples.

3. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others.

4. You shall not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part. Renesas Electronics disclaims any and all liability for any losses or damages

incurred by you or third parties arising from such alteration, modification, copy or otherwise misappropriation of Renesas Electronics products.

5. Renesas Electronics products are classified according to the following two quality grades: "Standard" and "High Quality". The intended applications for each Renesas Electronics product depends on the

product’s quality grade, as indicated below.

"Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic

equipment; and industrial robots etc.

"High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control (traffic lights); large-scale communication equipment; key financial terminal systems; safety control equipment; etc.

Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to human life or bodily injury (artificial life support devices or systems, surgical

implantations etc.), or may cause serious property damages (space and undersea repeaters; nuclear power control systems; aircraft control systems; key plant systems; military equipment; etc.). Renesas

Electronics disclaims any and all liability for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas

Electronics.

6. When using the Renesas Electronics products, refer to the latest product information (data sheets, user’s manuals, application notes, "General Notes for Handling and Using Semiconductor Devices" in the

reliability handbook, etc.), and ensure that usage conditions are within the ranges specified by Renesas Electronics with respect to maximum ratings, operating power supply voltage range, heat radiation

characteristics, installation, etc. Renesas Electronics disclaims any and all liability for any malfunctions or failure or accident arising out of the use of Renesas Electronics products beyond such specified

ranges.

7. Although Renesas Electronics endeavors to improve the quality and reliability of Renesas Electronics products, semiconductor products have specific characteristics such as the occurrence of failure at a

certain rate and malfunctions under certain use conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please ensure to implement safety measures to guard them

against the possibility of bodily injury, injury or damage caused by fire, and social damage in the event of failure or malfunction of Renesas Electronics products, such as safety design for hardware and

software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures by your own responsibility as warranty

for your products/system. Because the evaluation of microcomputer software alone is very difficult and not practical, please evaluate the safety of the final products or systems manufactured by you.

8. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. Please investigate applicable laws and

regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive carefully and sufficiently and use Renesas Electronics products in compliance with all

these applicable laws and regulations. Renesas Electronics disclaims any and all liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations.

9. Renesas Electronics products and technologies shall not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws

or regulations. You shall not use Renesas Electronics products or technologies for (1) any purpose relating to the development, design, manufacture, use, stockpiling, etc., of weapons of mass destruction,

such as nuclear weapons, chemical weapons, or biological weapons, or missiles (including unmanned aerial vehicles (UAVs)) for delivering such weapons, (2) any purpose relating to the development,

design, manufacture, or use of conventional weapons, or (3) any other purpose of disturbing international peace and security, and you shall not sell, export, lease, transfer, or release Renesas Electronics

products or technologies to any third party whether directly or indirectly with knowledge or reason to know that the third party or any other party will engage in the activities described above. When exporting,

selling, transferring, etc., Renesas Electronics products or technologies, you shall comply with any applicable export control laws and regulations promulgated and administered by the governments of the

countries asserting jurisdiction over the parties or transactions.

10. Please acknowledge and agree that you shall bear all the losses and damages which are incurred from the misuse or violation of the terms and conditions described in this document, including this notice,

and hold Renesas Electronics harmless, if such misuse or violation results from your resale or making Renesas Electronics products available any third party.

11. This document shall not be reprinted, reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics.

12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products.

(Note 1) "Renesas Electronics" as used in this document means Renesas Electronics Corporation and also includes its majority-owned subsidiaries.

(Note 2) "Renesas Electronics product(s)" means any product developed or manufactured by or for Renesas Electronics.

http://www.renesas.comRefer to "http://www.renesas.com/" for the latest and detailed information.

Renesas Electronics America Inc.2801 Scott Boulevard Santa Clara, CA 95050-2549, U.S.A.Tel: +1-408-588-6000, Fax: +1-408-588-6130Renesas Electronics Canada Limited9251 Yonge Street, Suite 8309 Richmond Hill, Ontario Canada L4C 9T3Tel: +1-905-237-2004Renesas Electronics Europe LimitedDukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, U.KTel: +44-1628-585-100, Fax: +44-1628-585-900Renesas Electronics Europe GmbHArcadiastrasse 10, 40472 Düsseldorf, GermanyTel: +49-211-6503-0, Fax: +49-211-6503-1327Renesas Electronics (China) Co., Ltd.Room 1709, Quantum Plaza, No.27 ZhiChunLu Haidian District, Beijing 100191, P.R.ChinaTel: +86-10-8235-1155, Fax: +86-10-8235-7679Renesas Electronics (Shanghai) Co., Ltd.Unit 301, Tower A, Central Towers, 555 Langao Road, Putuo District, Shanghai, P. R. China 200333Tel: +86-21-2226-0888, Fax: +86-21-2226-0999Renesas Electronics Hong Kong LimitedUnit 1601-1611, 16/F., Tower 2, Grand Century Place, 193 Prince Edward Road West, Mongkok, Kowloon, Hong KongTel: +852-2265-6688, Fax: +852 2886-9022Renesas Electronics Taiwan Co., Ltd.13F, No. 363, Fu Shing North Road, Taipei 10543, TaiwanTel: +886-2-8175-9600, Fax: +886 2-8175-9670Renesas Electronics Singapore Pte. Ltd.80 Bendemeer Road, Unit #06-02 Hyflux Innovation Centre, Singapore 339949Tel: +65-6213-0200, Fax: +65-6213-0300Renesas Electronics Malaysia Sdn.Bhd.Unit 1207, Block B, Menara Amcorp, Amcorp Trade Centre, No. 18, Jln Persiaran Barat, 46050 Petaling Jaya, Selangor Darul Ehsan, MalaysiaTel: +60-3-7955-9390, Fax: +60-3-7955-9510Renesas Electronics India Pvt. Ltd.No.777C, 100 Feet Road, HAL II Stage, Indiranagar, Bangalore, IndiaTel: +91-80-67208700, Fax: +91-80-67208777Renesas Electronics Korea Co., Ltd.12F., 234 Teheran-ro, Gangnam-Gu, Seoul, 135-080, KoreaTel: +82-2-558-3737, Fax: +82-2-558-5141

SALES OFFICES

© 2017 Renesas Electronics Corporation. All rights reserved.Colophon 6.0

(Rev.3.0-1 November 2016)