Getting Started with the DA16200 FreeRTOS SDK a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t2418

Contents

Introduction

Note: Before getting started with this tutorial, users should familiarize themselves with the DA16200 FreeRTOS Getting Started Guide for the DA16200MOD.

This tutorial is meant to supplement the DA16200 FreeRTOS Getting Started Guide and adapt the information specifically, to our DA16200 boards. The majority of the material in this tutorial, including the installation and examples, are derived from that manual.

Additionally, users should note that the information in this tutorial may become depricated and hyperlinks may break as Dialog/Renesas provides new software releases. Please, refer to the DA16200 product page for the latest updates and resources.

Advanced Software: Novice users, may find the amount information contained in this tutorial somewhat daunting. The SDK and IDE are relatively complex.

System Requirements: The minimum system requirements for the DA16200 FreeRTOS SDK are:

*For more information on the required software, please refer to the DA16200 FreeRTOS Getting Started Guide.

Manufactured by Dialog (a subsidiary of Renesas), the DA16200MOD is a highly integrated ultra-low power Wi-Fi system on chip (SoC). The DA16200 contains a 802.11b/g/n radio (PHY), a baseband processor, a media access controller (MAC), on-chip memory, and a host networking application processor, all on a single silicon die. With multiple sleep modes (down to 0.2 - 3.5 µA), the DA16200MOD perfect for your next IoT project. Additionally, the SoC has full offload capabilities to run the entire networking OS and TCP/IP stack on chip; therefore, an external network processor, CPU, or microcontroller are not required.


Arm Smart Home with SparkFun and Renesas DA16200 (Source: Arm)

Users can utilize the DA16200 FreeRTOS SDK and the Eclipse IDE on either a Windows 10 or Linux computer, to develop their Wi-Fi solutions. This guide will walk users through the download and installation process to get started with the DA16200 FreeRTOS SDK. Then, users will be shown the basic examples for the peripheral pin functions.

SparkFun Qwiic WiFi Shield - DA16200

SparkFun Qwiic WiFi Shield - DA16200

WRL-18567
$19.95
SparkFun MicroMod WiFi Function Board - DA16200

SparkFun MicroMod WiFi Function Board - DA16200

WRL-18594
$29.95 $14.98
1
SparkFun Thing Plus - DA16200

SparkFun Thing Plus - DA16200

WRL-19696
$34.95

Required Materials

To follow along with this guide, we recommend the hardware below. Users will need a DA16200 module and a way to connect it to their computer.

USB 3.1 Cable A to C - 3 Foot

USB 3.1 Cable A to C - 3 Foot

CAB-14743
$5.50
4
SparkFun Thing Plus - DA16200

SparkFun Thing Plus - DA16200

WRL-19696
$34.95

Suggested Reading

If you're unfamiliar with serial terminals, jumper pads, or I2C be sure to checkout some of these foundational tutorials.

How to Install CH340 Drivers

How to install CH340 drivers (if you need them) on Windows, Mac OS X, and Linux.

Dialog ULP WiFi DA16200 R3 Shield Hookup Guide

Add WiFi to your project with this hookup guide for our Dialog's Ultra Low Power DA16200 R3 shield!

MicroMod WiFi Function Board - DA16200 Hookup Guide

Add IoT functionality to any MicroMod project with the MicroMod WiFi function Board - DA16200!

DA16200 Thing Plus Hookup Guide

A guide to get started with the DA16200 Thing Plus.

Serial Communication

Asynchronous serial communication concepts: packets, signal levels, baud rates, UARTs and more!

Serial Terminal Basics

This tutorial will show you how to communicate with your serial devices using a variety of terminal emulator applications.

Connectivity of the Internet of Things

An overview of the different protocols that can be used for the development of Internet of Things (IoT)-based projects.

ARM Programming

How to program SAMD21 or SAMD51 boards (or other ARM processors).

FreeRTOS and SDK

To understand what is a FreeRTOS and how it is involved in the SDK for the Dialog DA16200 module, users will need to familiarize themselves with the fundamentals of operating systems (OS), schedulers, and real time operating systems (RTOS). In this section, a brief overview of these topics is presented below. However, for a more in-depth introduction to real time operating systems and some of the features of FreeRTOS, please check out the Digi-Key video series on RTOS presented by Shawn Hymel (former SparkFun personality):


Digi-Key video series on RTOS (Source: Youtube)

OS Scheduler

For any operating system (OS), an individual processor core is capable of running only one thread at a time. However, some operating systems implement a scheduler to control its processing resources; where, the scheduler allocates the processing time and priority of tasks executed on the processor's core(s). This allows the OS to create the illusion of running multiple programs simultaneously (i.e. multi-tasking) when the scheduler rapidly switches between the individual processes for each program.

Real Time Operating System (RTOS)

An operating system can be defined by how its scheduler prioritizes program execution. In a real time operating system (RTOS), the scheduler is designed to operate in a deterministic (i.e. predictable) execution pattern. This is ideal for embedded systems, which require a response to events within a specific time frame.

FreeRTOS

FreeRTOS is a prevalent real-time operating system that is distributed freely under the MIT open source license. It includes a kernel and a growing set of IoT libraries, which are designed to be light enough to run on a resource constrained processor; such as a microcontroller. Currently, the project is maintained by Amazon Web Services (AWS).

FreeRTOS was built with an emphasis on reliability and ease of use.

DA16200 FreeRTOS SDK

The DA16200 FreeRTOS SDK is provided and maintained by Renesas. It is a port of FreeRTOS, built specifically to operate on the DA16200 module. Unfortunately, due to the depth of information that can be covered, we won't go into details about the SDK operation beyond basic examples we provide.

For more documentation on FreeRTOS and the DA16200 FreeRTOS SDK, please refer to the resources below:

Software Setup

Note: The minimum system requirements for the DA16200 FreeRTOS SDK are: *For more information on the required software, please refer to the DA16200 FreeRTOS Getting Started Guide.

Users should have already familiarized themselves with the DA16200 FreeRTOS Getting Started Guide. While a majority of the information in this section is already covered in the DA16200 FreeRTOS Getting Started Guide, we have included a few additional details specific to the DA16200 boards in our catalog. Below, are a complete set of instructions for users to download, install, and setup the various programs required for the DA16200 FreeRTOS SDK.

Serial-to-UART Driver

Depending on the board and/or adapter being utilized, users will need to install the appropriate driver for their computer to recognize the serial-to-UART chip on their board/adapter. Most of the latest operating systems will recognize serial-to-UART chip on the board and automatically install the required driver.

To manually install the CH340 driver on their computer, users can download it from the WCH website. For more information, check out our How to Install CH340 Drivers Tutorial.

How to Install CH340 Drivers

August 6, 2019

How to install CH340 drivers (if you need them) on Windows, Mac OS X, and Linux.

Terminal Emulator (with Y-Modem)

In order to program their board through the USB-C connection and access the serial debug interface, users will need a serial terminal installed on their computer. We have verified that these emulators, below, support Y-Modem to upload the SDK bootloader and firmware. Users are welcome to use their preferred serial terminal, but we will only provide support with these applications for this tutorial.

Once installed, users will need to configure the serial terminal with the following settings for the COM port they are utilizing:

Download the DA16200 FreeRTOS SDK Image

In order to utilize the DA16200 FreeRTOS SDK, users should to program their board with the latest DA16200 FreeRTOS SDK firmware. To download the DA16200 FreeRTOS SDK Image, users will need to register an account first. Then, from the Design & Development tab of the DA16200MOD product page, users can download the:

Download firmware
Download the latest DA16200 FreeRTOS SDK firmware from the DA16200MOD product page. (Click to enlarge)

Download the DA16200 FreeRTOS SDK

Note: The Windows operating system has a path length limitation of 260 characters. Therefore, it is recommended that users extract the SDK into the root directory of the disk drive and rename the folder (i.e. C:/dialog_sdk).

To download the DA16200 FreeRTOS SDK, users will need to register an account first. Then, from the Design & Development tab of the DA16200MOD product page, users can download the:

Download SDK
Download the latest DA16200 FreeRTOS SDK from the DA16200MOD product page. (Click to enlarge)

For more information on the content of the DA16200 FreeRTOS SDK (i.e. file organization, API, example applications, etc.), please refer to the DA16200 FreeRTOS SDK Programmer Guide.

xPack Project Manager

Note: A recent version of Node.js (12.x or later) is required to install the following software.

Users will need to install the xPack Project Manager (xpm), to install the following xPack development tools required to utilize the SDK. Follow the instructions on the xPack website to install the software.

Installation Instructions for the xPack Project Manager

To install the xPack Project Manager (xpm) through Node.js, open a Windows command line or a Linux terminal and enter the following command:

language:bash
npm install --global xpm@latest

GCC Toolchain

In order to compile the code from the SDK, users will need to install the GNU Arm GCC (v10.2.1) cross compiler.

This development tool can be installed as an xPack package through the xPack Project Manager. Once users have installed the xpm, from the section above, open a Windows command line or a Linux terminal and enter the following command:

language:bash
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@10.2.1-1.1.2

Windows Build Tools

Note: Only for Windows operating systems.

Windows does not include any build tools (i.e. make) by default; therefore, users should install the Windows Build Tools xPack package.

This development tool can be installed as an xPack package through the xPack Project Manager. Once users have installed the xpm, from the section above, open a Windows command line and enter the following command:

language:bash
xpm install --global @xpack-dev-tools/windows-build-tools

Install and Setup Eclipse

The Eclipse IDE (integrated development environment) is a free and open source development platform that is released under the Eclipse Public License (EPL). The Eclipse IDE will be used to import the DA16200 FreeRTOS SDK into a workspace and build/compile the example projects using xPack development tools.

For more documentation on the Eclipse IDE, please refer to the resources below:

Installation

Installation of the Eclipse IDE is simple:

  1. Download the installer for the Eclipse IDE. (Users can also download the installation software from the Download or Getting Started pages.)
  2. Run the downloaded executable to launch the Eclipse Installer.

  3. Select the program's installation location and accept the software agreements.

Configuration

The first time users launch the Eclipse IDE, they be prompted to select a folder for the program's workspace. However, before users can proceed to working on a project, they will need to setup DA16200 FreeRTOS SDK and link the xPack development tools.

Configure the Development Tools:

In order to build the DA16200 FreeRTOS SDK, users will need to configure the Eclipse IDE and link the necessary development tools.

Import the DA16200 FreeRTOS SDK:

Note: The Windows operating system has a path length limitation of 260 characters. The <sdk_root_directory> path length must be less than 70 characters.

Users will also need to import the DA16200 FreeRTOS SDK into the Eclipse IDE:

  1. Download the DA16200 FreeRTOS SDK. (Users will need to register an account.)
  2. Extract the SDK zip file; this directory of this folder will be known as the <sdk_root_directory>.

  3. To setup the SDK in Eclipse, the top-level project contained in the <sdk_root_directory> should be imported. This will provide a view into the full SDK source code and will set up the launch and debug configurations required by the SDK.

Segger J-Link Software

Note: In order to program and debug the DA16200MOD, a J-Link Lite (or higher) programmer is required. Users may also be interested in these J-Link programmers and accessories.


Header - 2x5 Pin (Male, 1.27mm)

Header - 2x5 Pin (Male, 1.27mm)

PRT-15362
$1.75

J-Link EDU Mini Programmer

PGM-15345
1 Retired

J-Link BASE Compact Programmer

PGM-15347
Retired
JTAG 20 Pin 0.1 In. To 10 Pin 0.05 In. Adapter

JTAG 20 Pin 0.1 In. To 10 Pin 0.05 In. Adapter

PGM-18421
Retired

For a comparison of the different J-Link programmer models, please refer to the Segger website.

Below are the minimum requirements to setup the J-Link programmer to be used in the Eclipse IDE for the DA16200 FreeRTOS SDK:

In order to use the J-Link flash loader with the DA16200MOD, users will need to add it to the J-Link software:

  1. With the J-Link software already installed, find the installation directory and locate the JLinkDevices.xml file.
  2. Open JLinkDevices.xml in a text editor and add device entries for the DA16200 to the <DataBase> section as follows:

    language:xml
    <DataBase>
    <!-- ->
    <!-- Dialog Semiconductor ->
    <!-- ->
    <Device>
     <ChipInfo Vendor="Dialog Semiconductor" Name="DA16200_W25Q32JW" Core="JLINK_CORE_CORTEX_M4"
    WorkRAMAddr="0x80000" WorkRAMSize="0x00040000" />
     <FlashBankInfo Name="QSPI Flash" BaseAddr="0x100000" MaxSize="0x400000"
    Loader="Devices/Dialog/DA16200_W25Q32JW.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </Device>
    <Device>
     <ChipInfo Vendor="Dialog Semiconductor" Name="DA16200.SeggerES.4MB" Core="JLINK_CORE_CORTEX_M4" WorkRAMAddr="0x83000" WorkRAMSize="0x00020000" />
     <FlashBankInfo Name="QSPI Flash" BaseAddr="0x10000000" MaxSize="0x400000" Loader="Devices/Dialog/ES_DA16200_4MB.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </Device>
    <Device>
     <ChipInfo Vendor="Dialog Semiconductor" Name="DA16200.SeggerES.2MB" Core="JLINK_CORE_CORTEX_M4" WorkRAMAddr="0x83000" WorkRAMSize="0x00020000" />
     <FlashBankInfo Name="QSPI Flash" BaseAddr="0x10000000" MaxSize="0x200000" Loader="Devices/Dialog/ES_DA16200_2MB.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </Device>
    <Device>
     <ChipInfo Vendor="Dialog Semiconductor" Name="DA16200.eclipse.4MB" Core="JLINK_CORE_CORTEX_M4" WorkRAMAddr="0x83000" WorkRAMSize="0x00020000" />
     <FlashBankInfo Name="QSPI Flash" BaseAddr="0x10000000" MaxSize="0x400000" Loader="Devices/Dialog/DA16200_4MB.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </Device>
    <Device>
     <ChipInfo Vendor="Dialog Semiconductor" Name="DA16200.eclipse.2MB" Core="JLINK_CORE_CORTEX_M4" WorkRAMAddr="0x83000" WorkRAMSize="0x00020000" />
     <FlashBankInfo Name="QSPI Flash" BaseAddr="0x10000000" MaxSize="0x200000" Loader="Devices/Dialog/DA16200_2MB.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </Device>
    </DataBase>
    

    add new devices
    Device entries added to the JLinkDevices.xml file. (Click to enlarge)

  3. Copy the flash loader files from the <sdk_root_directory>/utility/j-link/scripts/flashloader/Devices/Dialog directory into the directory where the JLinkDevices.xml is located.
    flash loader files
    Flash loader files in the C:\Program Files (x86)\SEGGER\JLink\Devices\Dialog directory. (Click to enlarge)
  4. Configure the file path of the J-Link software in the Eclipse IDE
    1. In the Eclipse IDE, open the Window > Preferences dialog box.
      open preferences window
      Open the Preferences dialog box from the Window drop down menu in the Eclipse IDE. (Click to enlarge)
    2. In the preferences dialog box, select Run/Debug > String Substitution and press the New button.
      String Substitution menu
      Create a new variable. (Click to enlarge)
    3. Enter jlink_path as the variable name and set the value as the file path to the J-Link software:
      • C:\Program Files (x86)\SEGGER\JLink
      • C:\Users\<USER>\AppData\Roaming\SEGGER\JLinkDevices
        new variable
        Add the jlink_path variable linking to the J-Link software. (Click to enlarge)
    4. Click the OK and then the Apply and Close buttons to save the setting.

Note: If users are having trouble locating the flash loader files or modifying the JLinkDevices.xml file, please feel free to utilize this archived version of the files. These files are meant to be used with:

Download Archived Files (ZIP)

Follow the instructions below, to utilize the archived files:

  1. Extract the archived files from the j-link_files.zip zip folder.
  2. Replace the JLinkDevices.xml file in the C:\Program Files (x86)\SEGGER\JLink directory with the extracted file.
  3. Add the flash loader files by moving the extracted Dialog folder into the C:\Program Files (x86)\SEGGER\JLink\Devices directory.

Once the users have linked the J-Link software to the Eclipse IDE, they will need to import the j-link project to provide an absolute path for the SDK scripts to use. The project can be imported using the Eclipse Project Explorer by navigating to the <sdk_top_directory>/utility/j-link/project/ and then right click on that directory and select Import as Project.

import j-link scripts
Importing the J-Link scripts. (Click to enlarge)

For more information on utilizing J-Link with the DA16200 FreeRTOS SDK, please refer to the instructions in the <sdk_root_directory>\utility\j-link\scripts\ReadMe.txt file.

Serial Debug Interface

Note: This tutorial assumes that users are already familiar with serial terminals and their use. However, for those of who have never heard of them before, feel free to check our tutorials below:

The DA16200MOD can be controlled through the serial debug interface with the available console commands. The console is accessed by connecting the UART0 interface of the DA16200MOD module to a serial terminal on a computer.

Update SDK Firmware

Note: The version number of the firmware should match the version number of the DA162000 FreeRTOS SDK being used. Otherwise, users will run into issues when uploading or running an image built from the SDK.

Before proceeding further, users will need to update the firmware for the DA16200MOD.

To update the firmware on the DA16200MOD, users will need to connect to the module to a computer through the serial debug interface. From a serial terminal, users will use Y-Modem to upload the updated SDK bootloader and firmware images to the DA16200MOD.

Upload New Project Firmware

Note: The version number of the firmware should match the version number of the DA162000 FreeRTOS SDK being used. Otherwise, users will run into issues when uploading or running an image built from the SDK.

The process for uploading new firmware for an SDK project build is a similar method to updating the SDK firmware. Users will need to connect to the module to a computer through the serial debug interface. From a serial terminal, users will use Y-Modem to upload the new firmware image to the DA16200MOD.

Select the Boot Index

There are two slots, in which the main firmware image FRTOS can be stored in the SFLASH memory. These locations are at RTOS #0 (0x23000) and RTOS #1 (0x1e2000). Through the serial debug interface, users can specify which firmware image that the board boots up with.

  1. From the command console, the boot index can be changed using the boot_idx command
  2. After running the boot_idx command, run the reboot command to boot the firmware that was selected.

Erase Firmware

Users can erase the firmware from the SFLASH memory. This can be performed through the Net command mode.

  1. From the [/DA16200] # prompt, enter net to enter the NET command mode.
  2. From the [/DA16200/NET] # prompt, enter the ota_update info command to display the firmware information from the SFLASH memory
  3. Users can then use the ota_update erase_sflash <start> <size> command to erase a section of the 4MB SFLASH memory.

WiFi Provisioning

To configure the WiFi connection of the DA16200 Thing Plus, follow the instructions below:

  1. From the [/DA16200] # prompt, enter setup.
  2. Users will then be prompted Stop all services for the setting. Are you sure ? [Yes/No] :.
  3. After, country code list will be displayed and users will be prompted for their country code.
  4. Users will then be prompted to select a WiFi mode.
  5. A list of available networks will then be displayed and users will be prompted to select an option.
  6. Users will be prompted if they want to set advanced WiFi configuration.
  7. The WiFi connection settings will be displayed and users will be asked to confirm the configuration.
  8. Users will be asked to select a connection type.
  9. Users will be prompted to confirm the configuration.
  10. Lastly, users will be prompted about the SNTP Client and Dialog DPM (Dynamic Power Management).

WiFi provisioning
Configuring the WiFi connection through the serial debug interface. (Click to enlarge)

Once completed, the DA16200 will automatically reboot. After the splash screen, users should see a statement declaring that the board is in station mode (System Mode : Station Only (0)), which is eventually followed by a print out of information about the WiFi connection.

Build an Example Project

Each of the example project directories contain a folder structure, which includes a project folder with the DA16200 (or DA16600) target folder(s).


Directory in the Eclipse Project Explorer. (Click to enlarge)
To illustrate, the GPIO example application contains both the DA16200 and DA16600 target folders in the example's projects folder:

Import a Project

To build an example application (or project), users must import them into the Eclipse Project Explorer. Navigate to the specific example project directory, right-click on the DA16200 folder in the project directory, and then select Import as Project.

import project
Importing the target MCU (i.e. DA16200) folder of the example's projects folder. (Click to enlarge)

Build a Project

Once the target project is imported, it will appear in the Eclipse Project Explorer. To build the project, right-click on the imported project folder and select Build Project.

build a project
Building the imported, target project of an example application. (Click to enlarge)

Initial Build

The first time a build process is performed in the SDK, a Generate Configuration window will be displayed automatically to select the flash memory type. Users will need to select the flash memory type and press the Generate button to create the appropriate flash configuration file required to build the firmware.

Generate Configuration window pop-up
The Generate Configuration window to select the flash memory type of the project's target MCU. (Click to enlarge)

For the DA16200MOD, users will need to select:

selected flash memory
The Generate Configuration window to select the flash memory type of the project's target MCU. (Click to enlarge)

Project - Firmware Images

While the project builds, the following output is displayed in the Eclipse IDE's Console window:

build process
Build process for a project. (Click to enlarge)

Once complete, there are two firmware images that are generated:

The files are stored in the <sdk_root_directory>/<project_path>/img/ directory.

Configure the WiFi Connection

To configure the settings of the WiFi connection, users will need to modify the sample_preconfig.c file of the SDK from the apps > common > examples > common_config directory.

WiFi configuration file
The sample_preconfig.c WiFi configuration file for the DA16200 FreeRTOS SDK. (Click to enlarge)

Users will need to modify the following lines in the file to configure and enable the WiFi connection of the board:

file modifications
Configuring and enabling the WiFi connection for the SDK examples. (Click to enlarge)

Modify the Build Version

To configure the settings of the build version, users can modify the 2nd_major_number.c file of the SDK from the tools > version directory.

build version files
Modifying the version number of the SDK example builds. (Click to enlarge)

Programming and Debugging

There are two primary methods to update the main firmware (FRTOS) image, with Y-Modem through the serial debug interface or with a J-Link programmer (debugging probe).

Serial Terminal (Y-Modem)

Note: The version number of the firmware should match the version number of the DA162000 FreeRTOS SDK being used. Otherwise, users will run into issues when uploading or running an image built from the SDK.

Before proceeding further, users will need to update the firmware for the DA16200MOD.

To update the firmware on the DA16200MOD, users will need to connect to the module to a computer through the serial debug interface. From a serial terminal, users will need to use Y-Modem to upload the updated SDK bootloader and firmware images to the DA16200MOD.

Upload New Project Firmware

Note: The version number of the firmware should match the version number of the DA162000 FreeRTOS SDK being used. Otherwise, users will run into issues when uploading or running an image built from the SDK.

The process for uploading new firmware for an SDK project build is a similar method to updating the SDK firmware. Users will need to connect to the module to a computer through the serial debug interface. From a serial terminal, users will use Y-Modem to upload the new firmware image to the DA16200MOD.

J-Link Software

Hardware Note: In order to program and debug the DA16200MOD, a J-Link Lite (or higher) programmer (i.e. debug probe) is required. Users may need to solder on a JTAG header to connect a J-Link programmer to their board; an adapter may also be required.

Below are a few examples of J-Link programmers and JTAG accessories from our catalog:

Header - 2x5 Pin (Male, 1.27mm)

Header - 2x5 Pin (Male, 1.27mm)

PRT-15362
$1.75

J-Link EDU Mini Programmer

PGM-15345
1 Retired

J-Link BASE Compact Programmer

PGM-15347
Retired
JTAG 20 Pin 0.1 In. To 10 Pin 0.05 In. Adapter

JTAG 20 Pin 0.1 In. To 10 Pin 0.05 In. Adapter

PGM-18421
Retired

For a comparison of the different J-Link programmer models, please refer to the Segger website.

Software Note: Below are the minimum requirements to setup the J-Link programmer to be used in the Eclipse IDE for the DA16200 FreeRTOS SDK:

Program

To program binaries into a target device, users will need to execute the program_all_jtag_win script for Windows or the program_all_jtag_linux script for Linux in the External Tools menu.

  1. Select the project to be programmed in the Project Explorer.
  2. Under the Run menu, select External Tools (i.e. Run > External Tools).
  3. Select program_all_jtag_win or program_all_jtag_linux.
    program w/ j-link
    Select script to program with J-Link. (Click to enlarge)

The following scripts are available in the DA16200 FreeRTOS SDK:

Debug

To start debugging an application, right-click on the project in the Project Explorer and select Debug As > Debug Configurations.

run debug
Run the debug mode. (Click to enlarge)

Open the GDB SEGGER J-Link Debugging entry in the list and select one of the three debugging modes (reboot, attach, attach with RTOS info) and then select Debug.

select debug mode
Select the debug mode. (Click to enlarge)

There are three debug methods supported by J-Link: "reboot", "attach" and "attach with RTOS info" which are defined as follows:

OTA Update

There is a third option, however, it does require that the DA16200MOD module be preprogrammed to update its firmware over the air (OTA). Additionally, the firmware updates

Example: GPIO Control

This example will demonstrate how to import and build one of the example projects from the DA16200 FreeRTOS SDK. This example will utilize the GPIO example project from the <sdk_root_directory>/apps/common/examples/Peripheral folder of the SDK (apps > common > examples > Peripheral > GPIO). The example project is written to read and toggle certain GPIO pins.


The projects folder for the GPIO example, from the Peripheral examples folder of the DA16200 FreeRTOS SDK. (Click to enlarge)

By default, the example project will:

Below are the prebuilt images for the GPIO example project, using version 3.2.4.0 of the SDK:

Download the FBOOT Image for the DA16200 FreeRTOS SDK (v3.2.4.0)
Download the DA16200 FreeRTOS SDK (v3.2.4.0) FRTOS Image for the GPIO Example

Build Project

Users with the DA16200 Thing Plus, can blink the STAT LED by modifying the following lines in the peripheral_sample_gpio.c file in the <sdk_root_directory>/apps/common/examples/Peripheral/GPIO/src folder:

Users can also make the print outs in the serial debug interface easier to read by replacing low with low (add a extra space) to lines 177-179.

example code
The peripheral_sample_gpio.c file and most of the lines to modified in the Eclipde IDE. (Click to enlarge)

Once the peripheral_sample_gpio.c file has been modified to suit the users needs, the example project can be imported and built in the Eclipse IDE. Users can then use the serial debug interface to upload the new firmware to the board. Once users reboot the DA16200MOD module, the new firmware should run automatically.

GPIO print statements
Print outs from the serial debug interface. (Click to enlarge)

Users who have the DA16200 Thing Plus and have modified the code to toggle the STAT LED will see a blue LED blinking at about 1 second intervals.

Example: I2C

In the DA16200 FreeRTOS SDK, there is an I2C example project (apps > common > examples > Peripheral > I2C) that will write to and read from an EEPROM. This project is compatible with the Qwiic EEPROM. Below are the prebuilt images for the I2C example project, using version 3.2.4.0 of the SDK:

Download the FBOOT Image for the DA16200 FreeRTOS SDK (v3.2.4.0)
Download the DA16200 FreeRTOS SDK (v3.2.4.0) FRTOS Image for the I2C Example

Build Project

After users have imported and built the project from the SDK, they can connect the Qwiic EEPROM and program their board. (No code modifications are necessary for this example project.)

harware connection
The Qwiic EEPROM connected to the DA16200 Thing Plus. (Click to enlarge)

If connected properly, users should see a success message in the serial debug interface after the FRTOS image has been uploaded. The DA16200MOD will write 32 bytes to the EEPROM and then read the EEPROM to verify the data. The success message is displayed upon verification of the data.

success message
The success message of the example project in the serial debug interface. (Click to enlarge)

Example: WiFi

Note: In order to utilize this example, users will need to setup the module as a station and configure the WiFi settings.

STNP Sever

The Simple Network Time Protocol (SNTP) is as an Internet Protocol (IP) used to synchronize the clocks of networks of computers. In the DA16200 FreeRTOS SDK, there is an example project (apps > common > examples > ETC > Cur_Time) to access the Windows SNTP server and return the current time. Below are the prebuilt images for the Cur_Time example project, using version 3.2.4.0 of the SDK:

Download the FBOOT Image for the DA16200 FreeRTOS SDK (v3.2.4.0)
Download the DA16200 FreeRTOS SDK (v3.2.4.0) FRTOS Image for the Cur_Time Example

Once uploaded, if the WiFi connection has been provisioned, the board will print out the current time at regular intervals. At longer intervals, the current time will be updated from the Windows STNP server.

Build Project

To build the project, users should modify the following lines of code from the cur_time_sample.c file:

cur_time example in Eclipse
The cur_time_sample.c file and the lines to modify in the Eclipde IDE. (Click to enlarge)

Once the cur_time_sample.c file has been modified to suit the users needs, the example project can be imported and built in the Eclipse IDE. Users can then use the serial debug interface to upload the new firmware to the board. After users reboot the DA16200MOD module, the new firmware should run automatically. However, if the WiFi settings haven't been provisioned, users will need to configure the WiFi connection before the firmware starts outputting time stamps.

WiFi Configuration
The print statements from the Cur_Time example after the WiFi has been provisioned. (Click to enlarge)

OTA Firmware Update

Note: Based on our experience, we would suggest hosting the new firmware image in an AWS (Amazon web service) S3 bucket as mentioned in the OTA Update user manual. When we were testing the SDK examples, the HTTP requests would fail if firmware was hosted on our site or a GitHub repository.

The OTA (over the air) update example, allows users to update the firmware of the board by hosting the FRTOS image on a server. Through the WiFi connection, the board performs a simple HTTP request for the new firmware image. If the new image meets certain criteria, the board will download the firmware to a FRTOS slot in the SFlash memory and reboot that board to use that image.

Users can find the OTA update example project in the DA16200 FreeRTOS SDK (apps > common > examples > Network > OTA_Update). Below are the prebuilt images for the OTA_Update example project, using version 3.2.4.0 of the SDK:

Download the FBOOT Image for the DA16200 FreeRTOS SDK (v3.2.4.0)
Download the DA16200 FreeRTOS SDK (v3.2.4.0) FRTOS Image for the OTA Example

Build Project

To build the project, users should modify the following lines of code from the ota_update_sample.c file:

OTA example in Eclipse
The ota_update_sample.c file and the lines to modify in the Eclipde IDE. (Click to enlarge)

Once the ota_update_sample.c file has been modified to suit the users needs, the example project can be imported and built in the Eclipse IDE. Users can then use the serial debug interface to upload the new firmware to the board. After users reboot the DA16200MOD module, the new firmware should run automatically. However, if the WiFi settings haven't been provisioned, users will need to configure the WiFi connection before the new firmware can be downloaded and updated. The new firmware that is uploaded to the S3 bucket, toggles the GPIO pins, including GPIOA11 for the status LED.

Troubleshooting Tips

Note: Due to the fact that we did not develop the the DA16200 FreeRTOS SDK, there is minimal support in our forum beyond the information in this guide. For more extensive support, users should refer to the documentation provided by Renesas and FreeRTOS or create a post on the appropriate forum (linked below).

We have also included some troubleshooting tips, below, for issues that users may come across.

MacOSX

Unfortunately, Renesas does not provide support for their SDK on MacOSX computers. Users will need to use a computer with a Windows or Linux operating system.

Serial Terminal Frozen

We have found that users could accidentally upload code, which may not function properly and potentially bog down the serial terminal; impeding it from taking inputs. If this occurs, users will need to use the J-Link programmer to program the module (with "known good" code) through the JTAG pins.

Reset

The reset button on this board doesn't cause the module to restart the firmware operation; it is used to reset the DA16200 module to the factory setting/configuration (when held down for +5 seconds). In order to reset the firmware, users can use the following commands in the serial debug interface:

Linux Driver

To get started with the DA16200MOD on RZ/G2L Linux systems using the DA16200/600's Linux driver source code, please refer to the Linux Driver Getting Started Guide

Issue with Project Builds

For users who are having issues importing or building a project for one of the application examples, they may need to delete and re-import the DA16200 SDK into the workspace.

In the Project Explorer tab of the Eclipse IDE,

WiFi Examples

To utilize example projects that are dependent on a WiFi connection, users will need to configure the WiFi settings:

iPerf - Throughput Test

iPerf is an open-source, command-line network diagnostic tool. Users might be interested in this tool to perform a throughput test, which measures packet transfer performance. For more details on operating a throughput test, please refer to Section 6.3 of the Getting Started Guide:

OTA Update Example

With the OTA firmware update example, users may need to erase the firmware or swap which firmware image is currently running.

Erase the Firmware

When utilizing the OTA example, users may need to erase the firmware. This can be performed through the Net command mode.

  1. From the [/DA16200] # prompt, enter net to enter the NET command mode.
  2. From the [/DA16200/NET] # prompt, enter the ota_update info command to display the firmware information from the SFLASH memory
  3. Users can then use the ota_update erase_sflash <start> <size> command to erase a section of the 4MB SFLASH memory.

Boot Index

There are two slots, in which the main firmware image FRTOS can be stored in the SFLASH memory. These locations are at RTOS #0 (0x23000) and RTOS #1 (0x1e2000). Through the serial debug interface, users can specify which firmware image that the board boots up with.

  1. From the command console, the boot index can be changed using the boot_idx command
  2. After running the boot_idx command, run the reboot command to boot the firmware that was selected.

Boot Failures

During the development process, there may be times when there is an error in the code or a problem downloading the firmware which could cause the DA16200/600 to fail to boot properly.

Please refer to Appendix D of the DA16200 FreeRTOS Getting Started Guide.

Prebuilt Images

In case users lock-up or break the firmware on their board, they can upload these prebuilt images for the DA16200 FreeRTOS SDK (version 3.2.4.0). If the board is locked up, the only way to recover the board is flash the firmware with a J-Link debug probe. Click on the buttons below to download the prebuilt images:

Download the FBOOT Image for the DA16200 FreeRTOS SDK (v3.2.4.0)
Download the DA16200 FreeRTOS SDK (v3.2.4.0) FRTOS Image

Resources and Going Further

For more on the FreeRTOS and the DA16200 module, check out the links below:


learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado