In this training topic, you will write two binary images, harmony.bin (an MPLAB® Harmony 3 Software Framework Application) and boot.bin (Second-stage bootloader, at91bootstrap), to NOR Flash (QSPI) memory on the SAM9X60-EK Evaluation Kit using the SAM-BA® In-System Programmer (ISP). Once the images are written, and upon reset, the SAM9X60-EK will boot and run the application.
For this exercise, you will write the binaries that were created in the training topics:
- "SAM9X60-EK – Getting Started with MPLAB Harmony 3 Development: CSP Application: rtt_periodic_timeout"
- "SAM9X60-EK – Configure and Build at91bootstrap to Load an MPLAB Harmony 3 Application from NOR Flash (QSPI) Memory"
- SAM9X60-EK - Booting from QSPI Flash Memory
- SAM-BA In-System Programmer (ISP) Host Application installed on the host computer
This training topic was developed with SAM-BA ISP v3.7.
For this training, you will use the SAM9X60-EK Evaluation Kit.
SAM9X60-EK Evaluation Kit
Set up the SAM9X60-EK as listed below to the host computer running SAM-BA Host Application.
- Set the jumpers to their default positions as shown in SAM9X60-EK - Jumper Summary
SD Memory Cards
- Ensure no SD memory cards are plugged into the SD card (J4) connector.
- Apply power as shown in SAM9X60-EK - Power Options
Console Serial Communications
- To view the target console, connect the host computer running a terminal emulation program in accordance with "SAM9X60-EK – Console Serial Communications"
SAM-BA Host to Monitor Serial Communications
- Connect the host computer running the SAM-BA Host Application to the SAM9X60-EK in accordance with "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.
NOR Flash (QSPI) Memory
The SAM9X60-EK has a 64 Mbit Serial Quad I/O™ (SQI™) Flash memory (U8) (Microchip Technology SST26VF064B) that can be used for booting the system.
The at91bootstrap (boot.bin) binary will be written to location 0x0 to 0x0003FFFF. The MPLAB Harmony 3 Software Framework application (harmony.bin) binary will be written to location 0x00040000 to 0x000FFFFF.
Setup SAM-BA Host to Monitor Communications
In this section, you will establish SAM-BA Host Application communications with the target’s (SAM9X60) 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 3 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 USBA port (J7) on the SAM9X60-EK.
Ensure there is no SD memory card inserted in slot J4.
Open jumper the DISABLE_BOOT (J13).
This will allow booting from the onboard memories (NAND and NOR (QSPI) Flash memory).
Press both the DIS_BOOT (SW4) and nRST (Reset) (SW3) push buttons.
Pressing the DIS_BOOT (SW4) push button disables booting from the onboard memories.
Continue pressing DIS_BOOT (SW4) while releasing the nRST (Reset) (SW3) push button.
Release the DIS_BOOT (SW4) push button.
The SAM9X60-EK 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.
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.
Ensure that no other bootable Non-Volatile Memory (NVM) on the SAM9X60-EK contains a bootable image. Ensure there are no SD memory cards plugged into J4 and no bootable image in NAND Flash (U9). For information on the default boot sequence of the SAM9X60, see Section 12 – Boot Strategies in the SAM9X60 Datasheet.
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:
Write harmony.bin to NOR Flash (QSPI) Memory
In this section, you will write the MPLAB Harmony 3 Software Framework application binary image, harmony.bin, to NOR Flash memory.
Change directory to the location of harmony.bin:
Write harmony.bin to NOR Flash memory using the following sam-ba applet command:
$ sam-ba -p serial -b sam9x60-ek -a qspiflash -c write:harmony.bin:0x200000
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: "SAM9X60-EK – Configure and Build at91bootstrap to Load an MPLAB® Harmony 3 Application from NOR Flash (QSPI) Memory"
Run MPLAB Harmony 3 Application on the Target
To run the application, press the nRST (Reset) (SW3) push button. Observe the RGB LED (LD1) flashes blue. You can also observe the at91bootstrap reading from the NOR Flash memory on the console.
In this training topic, you wrote the binary files harmony.bin and boot.bin to NOR Flash (QPSI) memory on the SAM9X60-EK and ran the application on the target.
For training topics on configuring at91boostrap for other NVM, see:
Second-Stage Bootloader at91bootstrap
- "SAM9X60-EK – Configure and Build at91bootstrap to Load a MPLAB® Harmony 3 Application from NAND Flash Memory"
- "SAM9X60-EK – Configure and Build at91bootstrap to Load a MPLAB® Harmony 3 Application from SD Memory Card"
Writing to NVM