1.3.5 SAMA7D65 Curiosity Board: Building and Running the CAN 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. This content can also be download using content manager by following these instructions.
Path of the application within the repository is apps/mpu_can_bootloader/.
To build the application, refer to the following table and open the project using its IDE.
Bootloader Application
| Project Name | Description |
|---|---|
| bootloader_nand_flash/sama7d65/sam_a7d65_curiosity.X | MPLAB X Project for SAMA7D65 Curiosity Board |
Test Application
| Project Name | Description |
|---|---|
| test_app/sama7d65/sam_a7d65_curiosity.X | MPLAB X Project for SAMA7D65 Curiosity Board |
Setting Up SAMA7D65 Curiosity Board
- SAMA7D65 Curiosity Board is used for
both Host curiosity board and Target curiosity board

- Connect two SAMA7D65 Curiosity
board to each other as per the pin connections shown below
SAMA7D65 Curiosity Board - 1 SAMA7D65 Curiosity Board - 2 PIN 1, J28 (CAN1) PIN 1, J28 (CAN1) PIN 2, J28 (CAN1) PIN 2, J28 (CAN1) PIN 3, J28 (CAN1) PIN 3, J28 (CAN1) - Connect the UART Debug port (J35) on the host curiosity board to the computer using a FTDI-USB cable
- Connect the UART Debug port (J35) on the target curiosity board to the computer using a FTDI-USB cable
- Connect the USBA port J3 on the host curiosity board to the computer using a USB Type-C cable (to power the board)
- Connect the USBA port J3 on the target curiosity board to the computer using a USB Type-C cable (to power the board)
- Close Jumper J32 (CAN1) on the host curiosity board
- Close Jumper J32 (CAN1) and J36 (NAND BOOT) on the target curiosity board
- SD card with FAT32 file system for Host curiosity board
Using CAN SDCARD Host Application to Send the Application Binary to Target Curiosity Board

- Open the SDCARD host application project host_app_sdcard/sama7d65/sam_a7d65_curiosity.X in the IDE.
- Build the project to generate the harmony.bin binary (Do not program the binary).
- Open the test application project test_app/sama7d65/sam_a7d65_curiosity.X in the IDE.
- Build the project to generate the binary (Do not program the binary) and then rename the test application binary from harmony.bin to image.bin.
- Copy the MPU bootstrap application loader binary (boot.bin) from <harmony3_path>/bootloader_apps_can/deps/at91bootstrap_binaries_sam_a7d65_curiosity/application/sd_card/boot.bin onto the SD card.
- Copy the harmony Host application binary (harmony.bin) from <harmony3_path>/bootloader_apps_can/apps/mpu_can_bootloader/host_app_sdcard/sama7d65/sam_a7d65_curiosity.X/dist/default/production/harmony.bin onto the SD card.
- Copy the harmony Test application binary (image.bin) from <harmony3_path>/bootloader_apps_can/apps/mpu_can_bootloader/test_app/sama7d65/sam_a7d65_curiosity.X/dist/default/production/image.bin (renamed binary) onto the SD card.
- Insert the SD card into SD CARD connector on the Host board.
- Reset or Power cycle the device.
- Jump to Running the Application.
Running the Application
- Open the Terminal application (e.g., Tera Term) on the computer.
- Configure the serial port
settings as follows:
- Baud: 115200
- Data: 8 Bits
- Parity: None
- Stop: 1 Bit
- Flow Control: None
- Open the bootloader project bootloader_nand_flash/sama7d65/sam_a7d65_curiosity.X in the IDE.
- Build the project to generate the harmony_bootloader.bin binary (Do not program the binary).
- Download and unzip SAM-BA.
- Open the command prompt and
change the current directory to
<harmony3_path>/bootloader_apps_can/deps/at91bootstrap_binaries_sam_a7d65_curiosity/bootloader/nand_flash/
and run the below
command:
<sam-ba_path>/sam-ba.exe -p usb -b sama7d65-curiosity -a nandflash -c erase::0x40000 -c write:boot.bin - Change the current directory to
<harmony3_path>/bootloader_apps_can/apps/mpu_can_bootloader/bootloader_nand_flash/sama7d65/sam_a7d65_curiosity.X/dist/default/production/
and run the below
command:
<sam-ba_path>/sam-ba.exe -p usb -b sama7d65-curiosity -a nandflash -c erase:0x40000:0x80000 -c write:harmony_bootloader.bin:0x40000
- Reset or Power cycle the device. Green LED will be turned-on to indicate that harmony bootloader code is running on the target.
- Press the Switch USER on the Host curiosity board to trigger programming of the application binary.
- Once the programming is complete, Green LED on the Host curiosity board will be turned on indicating success.
- If above step is successful, then target curiosity board will be reset. Upon re-start, the harmony bootloader will jump to the user application.
- Green LED should start blinking
on the target board and the user should see below output on the console:

- Press and hold the Switch USER and then press Reset button or Power cycle the device on the target board to force trigger bootloader at startup.
- Press Reset button or
Power cycle the device on the host board and repeat steps 9-12 once.
- This step is to verify whether bootloader is triggered by switch press at reset on the target board
Additional Steps (Optional)
If required, the following commands need to be executed to set up boot configuration on the SAMA7D65 Curiosity board:
sam-ba -p usb -d sama7d65 -a bootconfig -c writecfg:bscr:EMULATION_ENABLED
sam-ba -p usb -d sama7d65 -a bootconfig -c resetemul
sam-ba -p usb -d sama7d65 -a reset
sam-ba -p usb -d sama7d65 -a bootconfig -c writecfg:bcp-otp:FLEXCOM6_USART_IOSET4,QSPI0_IOSET1_AT25,NFC_IOSET1_PMECC0xc2605007,SDMMC1_IOSET1To bootload any other application, refer to the Configuring an Application to be Bootloaded for MPUs.
