SAM-BA® In-System Programming and (ISP) - Boot MPLAB® Harmony Bare-Metal Application From NAND
Purpose
This tutorial shows how to program the required at91bootstrap and application binary images into NAND using SAM-BA® In-System Programming (ISPP) and verify that the application boots from NAND.
Overview
In this tutorial, you will
- Program the bootloader (build at91bootstrap.bin by following the "Configure and Build at91bootstrap to Boot MPLAB® Harmony Bare-Metal Application From NAND" tutorial) and application binary (see the harmony.bin build tutorial, "Getting Started With Application Development Using MPLAB® for VS Code® Extensions") into NAND using SAM-BA ISPP.
- Boot from NAND and verify output on the serial console.
Prerequisites
Download and install SAM-BA ISPP software v3.9.2 or the latest version.
Add the SAM-BA ISPP directory to your Path system environment variable.

Verify the installation. Open the Command Prompt and verify SAM-BA ISPP is accessible by running sam-ba –-version.

Procedure
Part 1: Program the Bootloader and Application Binary Into NAND Using SAM-BA ISPP
Connect the USB cable J1 from your host PC needed for the SAM-BA ISPP (ROM boot programming interface).
Power the board using a USB Type-C cable from your host through J14.

Connect the board to a serial terminal for console output at 115200 baud with the line ending set to "CR" through the FT4232H UART channel.
On the SAM9X75 Curiosity Hybrid Evaluation Board, Channel C of the FT4232H is connected to the UART.
Find the Channel C COM port number from Device Manager as follows:

Now connect to the serial monitor as follows:

Open NAND boot jumper J9.
Press the Reset button and observe the RomBOOT message being printed on the console
Close the NAND boot jumper J9 to enable NAND Chip Select.
Program NAND using SAM-BA ISPP software.
You can download the script (nand_flash.bat), pre-built binaries harmony.bin and at91bootstrap.bin from the GitHub® repository.
Run the nand_flash.bat script from the same folder where at91bootstrap.bin and harmony.bin are downloaded to flash NAND. It will flash the at91bootstrap and MPLAB Harmony v3 application binaries to NAND Flash memory.
The nand_flash.bat script contains three commands:
- sam-ba -p serial -b sam9x75-curiosity -a nandflash -c erase::0x100000
- sam-ba -p serial -b sam9x75-curiosity -a nandflash -c writeboot:at91bootstrap.bin -c verifyboot:at91bootstrap.bin
- sam-ba -p serial -b sam9x75-curiosity -a nandflash -c write:harmony.bin:0x40000 -c verify:harmony.bin:0x40000
Instead of running the script, you can execute the commands sequentially from the command prompt as well.

You can also monitor the serial console output while flashing NAND Flash memory using the SAM-BA ISPP software.

This completes flashing NAND with the required boot and application binaries.
Part 2: Boot from NAND and Verify Output on the Serial Console
Press Reset on the board.
Confirm on the serial console that the ROM code loads from NAND and that at91bootstrap starts and launches the MPLAB Harmony application (expected console banner/output and application behavior, such as LED behavior).
The sample application and console messages are shown in the accompanying image:


Results
You have successfully programmed both the bootloader and the MPLAB Harmony application into NAND using SAM‑BA ISPP and verified correct system startup by confirming the complete boot sequence from Boot ROM to at91bootstrap and finally to the MPLAB Harmony application, as observed through serial console output and expected application behavior.