Getting Started with the DA16200 FreeRTOS SDK

Pages
Contributors: santaimpersonator
Favorited Favorite 0

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.

  • There are two firmware images for the DA16200 FreeRTOS SDK:
    • 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
  • The DA16200 SDK can be used to build the firmware images for a specific example project from the DA16200 FreeRTOS SDK.

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.

  • 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.

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:

  • Erase all contents of the flash memory:
    • erase_all_jtag_win
    • erase_all_jtag_linux
  • Program all images into the flash memory:
    • program_all_jtag_win
    • program_all_jtag_linux
  • Program FBOOT image into the flash memory:
    • program_boot_jtag_win
    • program_boot_jtag_linux
  • Program FRTOS image into the flash memory:
    • program_rtos_jtag_win
    • program_rtos_jtag_linux

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:

  • DA16x_Main_Debug (Reboot) / Linux_DA16x_Main_Debug(reboot)
    • In this mode, the debugger is executed after rebooting the image stored in SFLASH.
    • In this mode, watchdog is turned off and wdt_kicking thread is not executed
  • DA16x_Main_Debug (Attach) / Linux_DA16x_Main_Debug(attach)
    • This mode executes the debugger in attach mode without rebooting the image currently stored in SFLASH.

      Note: Before using Attach mode, first turn off the watchdog using the sys.wdog off command as follows:

      [/DA16200] # sys.wdog off

  • DA16x_Main_Debug (attach_with_rtos_info) / Linux_DA16x_Main_Debug(attach_with_rtos_info)
    • Same as attach mode but displays thread information when in the debugger suspend state
      Note: The current FreeRTOS SDK does not support automatic downloading of the firmware image into flash through the Eclipse debug interface. Therefore, the firmware must be loaded into SFLASH before starting to debug the application.

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