Getting Started with the DA16200 FreeRTOS SDK

Pages
Contributors: santaimpersonator
Favorited Favorite 0

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:

  • Depending on the board and/or adapter being utilized, users may need to install the appropriate driver for their computer to recognize the serial-to-UART chip on their board/adapter.

    How to Install CH340 Drivers

    August 6, 2019

    How to install CH340 drivers (if you need them) on Windows, Mac OS X, and Linux.
  • Users will also need a serial terminal installed on their computer to access the serial debug interface.

    The serial terminal should be configured with the following settings:

    • Baud Rate: 230400 bps
    • Data Bits: 8 (8-N-1)
    • Parity: None
    • Stop Bits: 1
    • Flow Control (HW/SW): None

    Serial Terminal Basics

    September 9, 2013

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

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.

  • To operate various functions of the DA16200MOD module, please refer to Appendix B of the DA16200 FreeRTOS Getting Started Guide for a full list of the available debug interface commands.
  • For examples of how to utilize the serial debug interface, please refer to sections 4.4 - 4.6 and section 6 of the DA16200 FreeRTOS Getting Started Guide.
    • Section 4.6 - WiFi Provisioning
    • Section 6.3 - Throughput Test
    • Section 6.4 - Dynamic Power Management (DPM) Setup

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.

  • There are two firmware images for the DA16200:
    • FBOOT is the bootloader image which is used to initialize the DA16200 and launch the main firmware.
      • File Name: DA16200_FBOOT-GEN01-01-XXXXXXXXX_W25Q32JW.img
      • The bootloader image must be the first thing loaded into flash for a new device.
      • Since the bootloader image contains SFDP (flash specific) information, the bootloader must be loaded into flash before other images are loaded.
      • When the SDK is updated, always load the bootloader image first.
    • FRTOS is the main firmware image which includes the RTOS and user applications.
      • File Name: DA16200_FRTOS-GEN01-01-XXXXXXXXX-XXXXXX.img
      • There are two slots in the SFlash memory to upload the main firmware image:
        • RTOS #0 begins at 0x023000
        • RTOS #1 begins at 0x1e2000
  • The DA16200 SDK can be used to build the firmware images for a specific example project from the DA16200 FreeRTOS SDK.
  • Prebuilt versions of the latest firmware for DA16200 can be downloaded from the Renesas product page.
    • Users can download the latest images from the Software Downloads section of the Design & Development tab. The firmware images should be named: DA16200 DA16600 FreeRTOS SDK Image <version>. (Users will need an account to download these files.)
      Download firmware
      Download the latest DA16200 FreeRTOS SDK firmware from the DA16200MOD product page. (Click to enlarge)

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.

  • To update the firmware images on the DA16200:

    1. In the serial terminal, at the [/DA16xxx] prompt, enter reset to access to the MaskROM mode.
      initial boot
      Splash screen and intial prompt for the serial debug interface. (Click to enlarge)
    2. At the [MROM] prompt, use the loady command to upload one of the firmware images.
      mrom mode
      MROM command mode. (Click to enlarge)
      • For the second bootloader firmware image (FBOOT), use the loady boot or loady 0 command.
        loady boot
        Command to upload the FBOOT image. (Click to enlarge)
      • For the main firmware image (FRTOS), use the loady 23000 command (for RTOS #0).
        loady 23000
        Command mode to upload the FRTOS image. (Click to enlarge)
    3. In the terminal emulation program, start the Y-Modem file transfer:
      • For Windows Tera Term:
        • From the File menu, select Transfer > YMODEM > Send.
          y-modem send
          Y-Modem file transfer. (Click to enlarge)
        • Navigate to where the firmware image is stored, choose the required firmware image and start the download.
          select firmware image
          Select firmware image. (Click to enlarge)
      • For Linux minicom:
        • Press Ctrl+A+S and select ymodem from the menu.
        • Navigate to where the firmware image is stored, choose the required firmware image and start the download.
          select boot image
          Select firmware image. (Click to enlarge)
    4. After the transfer completes, the total size is displayed.

      boot transfer

      boot transfer complete
      firmware transfer

      firmware transfer complete

      Y-Modem file transfer completed. (Click to enlarge)

    5. When updating the firmware images for a new version of the SDK, both the second bootloader firmware image (FBOOT) and the main firmware image (FRTOS) must be uploaded.
      • When uploading a main firmware image (FRTOS) for a project built with the SDK (no version update), it isn't necessary to upload the second bootloader firmware image (FBOOT).
    6. After all firmware images have been uploaded to the DA16200MOD, use the boot command at the [MROM] prompt to restart the firmware.
    7. After the firmware reboots, at the [/DA16200] prompt, users can return the DA16200MOD to a factory configuration state with the factory command.
      factory reset
      Factory reset command. (Click to enlarge)
      • When prompted, enter y to confirm.
        factory reset complete
        Reboot after a factory reset. (Click to enlarge)
  • With TeraTerm (Windows only), users can also upload the SDK bootloader and firmware using the TeraTerm script.
    • Tera Term script is only available with the prebuilt versions of firmware downloaded from the Renesas product page. (The script is not generated with the images from the DA16200 FreeRTOS SDK project builds.)
    • Once terra term is running and connected to the DA16200MOD, open the Control menu and select Macro. When the Macro file selection window opens, navigate to the directory where the firmware images are stored and select the *.ttl file.
      tera term script
      Uploading the SDK bootloader and firmware using the TeraTerm script. (Click to enlarge)

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.

  • To update the firmware images on the DA16200:
    1. In the serial terminal, at the [/DA16xxx] prompt, enter reset to access to the MaskROM mode.
      initial boot
      Splash screen and intial prompt for the serial debug interface. (Click to enlarge)
    2. At the [MROM] prompt, use the loady command to upload one of the firmware images.
      • For the main firmware image (FRTOS), use the loady 23000 command for RTOS #0.
      • When uploading a main firmware image (FRTOS) for a project built with the SDK (no version update), it isn't necessary to upload the second bootloader firmware image (FBOOT).
        loady 23000
        Command mode to upload the FRTOS image. (Click to enlarge)
    3. In the terminal emulation program, start the Y-Modem file transfer:
      • For Windows Tera Term:
        • From the File menu, select Transfer > YMODEM > Send.
          y-modem send
          Y-Modem file transfer. (Click to enlarge)
        • Navigate to where the firmware image is stored, choose the required firmware image and start the download.
      • For Linux minicom:
        • Press Ctrl+A+S and select ymodem from the menu.
        • Navigate to where the firmware image is stored, choose the required firmware image and start the download.
    4. After the transfer completes, the total size is displayed. Use the boot command at the [MROM] prompt to restart the firmware.

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
    • boot_idx 0 - sets RTOS #0 as the firmware to boot
    • boot_idx 1 - sets RTOS #1 as the firmware to boot
  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.
    • Example: To remove the firmware operating in the RTOS #1 section (0x1e2000) with 1078496 bytes of memory, users will use the command ota_update erase_sflash 0x1e2000 1078496
      erasing sflash memory
      Erasing the firmware from the SFLASH memory for RTOS #1. (Click to enlarge)

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] :.
    • Select yes, by returning y.
  3. After, country code list will be displayed and users will be prompted for their country code.
    • Users that live in the USA should enter us for their country code.
  4. Users will then be prompted to select a WiFi mode.
    • Select 1 to configure the DA16200 Thing Plus for station mode.
  5. A list of available networks will then be displayed and users will be prompted to select an option.
    • Users should enter the number of the network, which they would like to use.
  6. Users will be prompted if they want to set advanced WiFi configuration.
    • Enter n to skip this step.
  7. The WiFi connection settings will be displayed and users will be asked to confirm the configuration.
    • If the settings are correct, enter y to confirm the configuration.
  8. Users will be asked to select a connection type.
    • Enter a to select an automatic DHCP IP address.
  9. Users will be prompted to confirm the configuration.
    • Enter y to confirm the configuration.
  10. Lastly, users will be prompted about the SNTP Client and Dialog DPM (Dynamic Power Management).
    • Enter n for both of these options.

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.