SAM9X60-EK – Writing MPLAB® Harmony 3 Application and at91bootstrap to NAND Flash Memory Using SAM-BA ISP
Introduction
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 NAND Flash 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 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 NAND Flash Memory
Prerequisites
The following are prerequisites to complete this training:
- SAM9X60-EK - Booting from NAND Flash Memory
- SAM-BA ISP host application installed on the host computer
Hardware
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 the SAM-BA host application.
Jumpers
- Set the jumpers to their default positions as shown in the "Jumper Summary" section in the "SAM9X60-EK — Features" page.
SD Memory Cards
- Ensure no SD memory cards are plugged into SD card (J4) connector.
Power
- Apply power as shown in the "Power Options" section in the "SAM9X60-EK — Features" page.
Console Serial Communications
- To view the target console, connect the host computer running a terminal emulation program in accordance with the "SAM9X60-EK – Console Serial Communications" page.
SAM-BA Host to Monitor Serial Communications
- Connect the host computer running the SAM-BA host application to the SAM9X60-EK in accordance with the "SAM-BA Host to Monitor Serial Communications" page.
NAND Flash Memory
The SAM9X60-EK has a 4 Gb (512M x 8) NAND Flash memory (U9) (Micron MT29F4G08ABAEA) 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 (nandflash) to erase and then write the boot.bin (at91bootstrap) and harmony.bin (MPLAB Harmony 3 Software Framework application) binary images to NAND Flash memory.
Open jumper the DISABLE_BOOT (J13).
This will allow booting from the onboard memories (NAND and NOR (QSPI) Flash memory).
Pressing the DIS_BOOT (SW4) push button disables booting from the onboard memories.
Release the DIS_BOOT (SW4) push button.
Erase NAND Flash Memory
In this section, you will erase the contents of the NAND Flash Memory. This is a necessary step before writing data to NAND Flash memory.
Erase the contents of the NAND Flash memory using the following SAM-BA host applet command:
Write boot.bin to NAND Flash Memory
In this section, you will write the at91bootstrap binary image, boot.bin, to NAND Flash memory.
Change the directory to the location of boot.bin:
Write boot.bin to NAND Flash memory using the following SAM-BA applet command:
Write harmony.bin to NAND Flash Memory
In this section, you will write the MPLAB Harmony 3 Software Framework application binary image, harmony.bin, to NAND Flash memory.
Change the directory to the location of harmony.bin:
Write harmony.bin to NAND Flash memory using the following sam-ba applet command:
The write command is write:<filename>:[<addr>] where <addr> is the Flash Offset for Demo App value in the at91bootstrap configuration (Kconfig). The value 0x40000 you took note of in the "SAM9X60-EK – Configure and Build at91bootstrap to Load a MPLAB® Harmony 3 Application from NAND Flash Memory" training page.
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 NAND Flash memory on the console.
Summary
In this training, you wrote the binary files harmony.bin and boot.bin to NAND Flash memory on the SAM9X60-EK and ran the application on the target.
Learn More
- SAM9X60-EK – Configure and Build at91bootstrap to Load an MPLAB® Harmony 3 Application from NOR Flash (QSPI) Memory
- SAM9X60-EK – Configure and Build at91bootstrap to Load an MPLAB® Harmony 3 Application from SD Memory Card
- SAM9X60-EK – Writing MPLAB Harmony 3 Application and at91bootstrap to NOR Flash (QSPI) Memory using SAM-BA ISP
- SAM9X60-EK – Copy MPLAB Harmony 3 Application and at91bootstrap to SD Memory Card