1.3.1 SAM9X75-Curiosity Board: Building and Running the OTA Bootloader With NAND Flash Media Applications

Downloading and Building the Application

To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repo or download as zip file.

Path of the application within the repository is apps/ble/mpu/sam9x75_nand_flash/.

To build the application, refer to the following table and open the project using its IDE.

OTA Bootloader

Project NameDescription
ota_bootloader/sam_9x75_curiosity.XMPLABX Project for SAM9X75-Curiosity Board

OTA Application

Project NameDescription
ota_app/sam_9x75_curiosity.XMPLABX Project for SAM9X75-Curiosity Board

Setting Up SAM9X75-Curiosity Board

  • To run the demo, the following additional hardware are required:

  • Short J2-1 and J2-2 using jumper in the RNBD451 Add On Board

  • Insert RNBD451 Add On Board board into MIKROBUS Connector

  • Connect the DBGU0 J35 on curiosity board to the computer using a UART-FTDI cable (to enable debug com port)

  • Connect the USB port J2 on curiosity board to the computer using a micro USB cable (to power the board)

  • Close (Short) jumper NAND BOOT on the target curiosity board

Setting Up the Host Scripts

Running the Application

  1. Open the Terminal application (Ex.:Tera Term) on the computer.

  2. Configure the serial port settings as follows:

    • Baud: 115200
    • Data: 8 Bits
    • Parity: None
    • Stop: 1 Bit
    • Flow Control: None
  3. Open the bootloader project ota_bootloader/sam_9x75_curiosity.X in the IDE.

  4. Build the project to generate the harmony_bootloader.bin binary (Do not program the binary).

  5. Open the application project ota_app/sam_9x75_curiosity.X in the IDE.

  6. Build the project to generate the harmony.bin binary (Do not program the binary).

  7. Download and unzip SAM-BA.

  8. Open the command prompt and change the current directory to <harmony3_path>/bootloader_apps_ota/deps/at91bootstrap_binaries_sam_9x75_curiosity/bootloader/nand_flash/ and run the below command:

     <sam-ba_path>/sam-ba.exe -p usb -b sam9x75-curiosity -a nandflash -c erase::0x40000 -c writeboot:boot.bin
  9. Change the current directory to <harmony3_path>/bootloader_apps_ota/apps/ble/mpu/sam9x75_nand_flash/ota_bootloader/sam_9x75_curiosity.X/dist/default/production/ and run the below command:

     <sam-ba_path>/sam-ba.exe -p usb -b sam9x75-curiosity -a nandflash -c erase:0x40000:0x80000 -c write:harmony_bootloader.bin:0x40000
  10. Change the current directory to <harmony3_path>/bootloader_apps_ota/apps/ble/mpu/sam9x75_nand_flash/ota_app/sam_9x75_curiosity.X/dist/default/production/ and run the below command to generate the metadata binary metadata.bin:

    python <harmony3_path>/bootloader_apps_ota/tools/generate_metadata.py -f harmony.bin
  11. Run the below command to program the metadata binary metadata.bin:

    <sam-ba_path>/sam-ba.exe -p usb -b sam9x75-curiosity -a nandflash -c erase:0x180000:0x40000 -c write:metadata.bin:0x180000
  12. Run the below command to program the ota application binary harmony.bin:

    <sam-ba_path>/sam-ba.exe -p usb -b sam9x75-curiosity -a nandflash -c erase:0x200000:0x40000 -c write:harmony.bin:0x200000
  13. Reset or Power cycle the device. Green LED will be blinking to indicate that the OTA application is running.

    • Observe the below message on console:
    console_output1
  14. Open the OTA application project ota_app/sam_9x75_curiosity.X in the IDE.

  15. Update ota_app/src/app.c to update printf() message from ####### Application running ####### to ####### New Application running ####### as below:

    app_source
  16. Clean and Build the OTA application project to generate the binary (Do not program the binary).

  17. Go to the <harmony3_path>/bootloader_apps_ota/apps/ble/mpu/sam9x75_nand_flash/ota_app/sam_9x75_curiosity.X/dist/default/production/ directory and open the command prompt to run the below command:

    python <harmony3_path>/bootloader_apps_ota/tools/ota_host_mcu_header.py -p 0x0 -j 0x0 -l 0x0 -f harmony.bin
    • This command adds OTA Host MCU Header to the application binary. If command executed successful then "image.bin is generated successfully" message display on the command prompt.
    • Note: Memory addresses are configured from MCC harmony and it is not used from above command.
  18. Run the below command:

    python <harmony3_path>/bootloader_apps_ota/tools/ota_rnbd_header.py -f image.bin
    • This command adds OTA RNBD Header to the image.bin and generates RNBD_image.bin application binary. If command executed successful then "RNBD_image.bin is generated successfully" message display on the command prompt.
  19. Refer to the Send application binary using MBD App to program RNBD_image.bin application binary to the target.

  20. Once Firmware Update is successful:

    • Green LED still blinking indicating that the OTA application is running
    • Observe the below message on console:
    console_output2
  21. Repeat Step 15-20.

    • Observe Green LED still blinking
    • Observe message printed on console

Additional Steps (Optional)