SAM9X75 Curiosity – Writing MPLAB® Harmony v3 Application and at91bootstrap to NOR Flash (QSPI) Memory using SAM-BA® ISP

Last modified by Microchip on 2024/10/25 16:21

Introduction

In this training topic, you will write two binary images, harmony.bin (an MPLAB® Harmony v3 Software Framework Application) and boot.bin (Second-stage bootloader, at91bootstrap), to NOR Flash (QSPI) memory on the SAM9X75-Curiosity Development Board using the SAM-BA® In-System Programmer (ISP). Once the images are written, and upon reset, the SAM9X75-Curiosity will boot and run the application.

For this exercise, you will write the binaries that were created in the training topics:

Prerequisites

The following are prerequisites to complete this training:

​This training topic was developed with SAM-BA ISP v3.8.1.

Back to Top

Hardware

For this training, you will use the SAM9X75 Curiosity LAN Kit.

SAM9X75-Curiosity Development Board

Set up the SAM9X75-Curiosity as listed below to the host computer running SAM-BA host application.

Jumpers

SD Memory Cards

  • Ensure no SD memory cards are plugged into the SD card (J14) connector.

Power

Console Serial Communications

SAM-BA Host to Monitor Serial Communications

​Be certain that the SAM-BA host application has been added to the path.

​Be sure to observe RomBOOT on the console. Otherwise, the SAM-BA host application cannot talk to the monitor on the target.

​For more information on SAM-BA host applets, see "SAM-BA ISP - Applets" page.

Back to Top

NOR Flash (QSPI) Memory

The SAM9X75-Curiosity has a 64 Mbit Serial Quad I/O™ (SQI™) Flash memory (U6) (Microchip Technology SST26VF064B) that can be used for booting the system.

The at91bootstrap (boot.bin) binary will be written to locations 0x0 to 0x0003FFFF. The MPLAB Harmony v3 Software Framework application (harmony.bin) binary will be written to locations 0x00040000 to 0x000FFFFF.

NOR Flash Memory Map

Back to Top

Setup SAM-BA Host to Monitor Communications

In this section, you will establish SAM-BA host application communications with the target’s (SAM9X75) SAM-BA monitor. Then you will use the SAM-BA host applet (qspiflash) to erase and then write the boot.bin (at91bootstrap) and harmony.bin (MPLAB Harmony v3 Software Framework application) binary images to NOR Flash (QSPI) memory.

To communicate with the SAM-BA monitor on the target, you must have installed the SAM-BA host on a host computer and connect a Micro-B USB cable to the USB Type-A port (J2) on the SAM9X75-Curiosity.

Back to Top


Ensure there is no SD memory card inserted in slot J14.

Back to Top


Open the NAND BOOT Jumper (J9).

This will disable booting from the NAND memory.

Back to Top


Close the QSPI BOOT Jumper (J10).

This will allow booting from the NOR (QSPI) Flash memory.

Back to Top


Press nRST (Reset) (SW3) push buttons. 

The SAM9X75-Curiosity will boot to the SAM-BA monitor and start communications with the SAM-BA host application.

If you have the Console Serial Communications established, you can observe ROMBoot on the Console (terminal emulator) indicating the SAM-BA monitor is running.

Back to Top

Erase NOR Flash (QSPI) Memory

In this section, you will erase the contents of the NOR Flash memory. This is a necessary step before writing data to NOR Flash memory.

​For more information on the SAM-BA applet qspiflash, see the "SAM-BA ISP - Applets: Program External NAND Flash Memory" page.

​Ensure that no other bootable NVMs on the SAM9X75-Curiosity contain a bootable image. Also, ensure that no SD memory card is plugged into J14 and that no bootable image is in NAND Flash (U5). For information on the SAM9X75's default boot sequence, see Section 12, "Boot Strategies," in the SAM9X75 datasheet.

Erase the contents of the NOR Flash memory using the following SAM-BA host applet command:

$ sam-ba -p serial -b sam9x75-curiosity -a qspiflash -c erase

SAM-BA: qspiflash erase beginning

SAM-BA: qspiflash erase ending

Console: qspiflash erase

Back to Top

Write boot.bin to NOR Flash (QSPI) Memory

In this section, you will write the at91bootstrap binary image, boot.bin, to NOR Flash memory.

Change directory to the location of boot.bin:

<project_directory>\at91bootstrap\build\binaries\boot.bin

Back to Top


Write boot.bin to NOR Flash memory using the following SAM-BA applet command:

$ sam-ba -p serial -b sam9x75-curiosity -a qspiflash -c writeboot:boot.bin -c verifyboot:boot.bin

The writeboot command is used when programming a bootstrap file into an external NOR Flash memory boot partition.

SAM-BA: qspiflash writeboot

Console: qspiflash writeboot

Back to Top

Write harmony.bin to NOR Flash (QSPI) Memory

In this section, you will write the MPLAB Harmony v3 Software Framework application binary image, harmony.bin, to NOR Flash memory.

Change directory to the location of harmony.bin:

C:\Users\<user>\HarmonyContent\csp_apps_sam_9x7\apps\rtt\rtt_periodic_timeout\firmware\rtt_periodic_timeout_sam_9x75_Curiosity.X\dist\sam_9x75_curiosity\production

Back to Top


Write harmony.bin to NOR Flash memory using the following sam-ba applet command:

$ sam-ba -p serial -b sam9x75-curiosity -a qspiflash -c write:harmony.bin:0x40000 -c verify:harmony.bin:0x40000

The write command is write:<filename>:[<addr>] where <addr> is the Flash Offset for Demo App value in the at91bootstrap configuration (Kconfig). The value 0x200000 you took note of in the training: "SAM9X75-Curiosity – Configure and Build at91bootstrap to Load an MPLAB® Harmony v3 Application from NOR Flash (QSPI) Memory"

Linker for Production: ddram

SAM-BA: qspiflash write

Console: qspiflash write

Back to Top

Run MPLAB Harmony v3 Application on the Target

Press the nRST (Reset) (SW3) push button to run the application. The RGB LED (LD1) should flash blue. You can also observe the at91bootstrap reading from the NAND Flash memory on the console.

Console run

Back to Top

Summary

In this training topic, you wrote the binary files harmony.bin and boot.bin to NOR Flash (QSPI) memory on the SAM9X75-Curiosity and ran the application on the target.

Back to Top