Jump to main content

# 1.3.2 SAM9X75-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.

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/sam9x75/sam_9x75_curiosity.X | MPLABX Project for SAM9X75-Curiosity Board

Test Application

Project Name | Description
--- | ---
test_app/sam9x75/sam_9x75_curiosity.X | MPLABX Project for SAM9X75-Curiosity Board

Setting up SAM9X75-Curiosity Board

- SAM9X75-Curiosity Board is used for both Host curiosity board and Target curiosity board

- Insert ATA6563 click Board in the mikroBUS slot of Host curiosity board

- Insert ATA6563 click Board in the mikroBUS slot of Target curiosity board

- Connect two SAM9X75 Curiosity Board to each other through ATA6563 click Board as per the pin connections shown below

SAM9X75 Curiosity Board-1 | SAM9X75 Curiosity Board-2
--- | ---
CAN1_H | CAN1_H
CAN1_L | CAN1_L
GND | GND

- Connect the DBGU0 J35 on Host curiosity board to the computer using a UART-FTDI cable (to enable debug com port)
- Connect the DBGU0 J35 on Target curiosity board to the computer using a UART-FTDI cable (to enable debug com port)
- Connect the USB port J2 on Host curiosity board to the computer using a micro USB cable (to power the board)
- Connect the USB port J2 on Target curiosity board to the computer using a micro USB cable (to power the board)
- Close (Short) jumper 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

1. Open the SDCARD host application project host_app_sdcard/sam9x75/sam_9x75_curiosity.X in the IDE.
2. Build the project to generate the harmony.bin binary (Do not program the binary).
3. Open the test application project test_app/sam9x75/sam_9x75_curiosity.X in the IDE.
4. 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.
5. Copy the MPU bootstrap application loader binary (boot.bin) from <harmony3_path>/bootloader_apps_can/deps/at91bootstrap_binaries_sam_9x75_curiosity/application/sd_card/boot.bin onto the SD Card.
6. Copy the harmony Host application binary (harmony.bin) from <harmony3_path>/bootloader_apps_can/apps/mpu_can_bootloader/host_app_sdcard/sam9x75/sam_9x75_curiosity.X/dist/default/production/harmony.bin onto the SD Card.
7. Copy the harmony Test application binary (image.bin) from <harmony3_path>/bootloader_apps_can/apps/mpu_can_bootloader/test_app/sam9x75/sam_9x75_curiosity.X/dist/default/production/image.bin (renamed binary) onto the SD Card.
8. Insert the SD card into SD BOOT connector J14 on the Host board.
9. Reset or Power cycle the device.
10. Jump to Running The Application.

Running the Application

1. Open the Terminal application (Ex.:Tera Term) on the computer.

2. Configure the serial port settings as follows:

   - Baud: 115200
   - Data: 8 Bits
   - Parity: None
   - Stop: 1 Bit
   - Flow Control: None

3. Open the bootloader project bootloader_nand_flash/sam9x75/sam_9x75_curiosity.X in the IDE.

4. Build the project to generate the harmony_bootloader.bin binary (Do not program the binary).

5. Download and unzip SAM-BA.

6. Open the command prompt and change the current directory to <harmony3_path>/bootloader_apps_can/deps/at91bootstrap_binaries_sam_9x75_curiosity/bootloader/nand_flash/ and run the below command:

        <sam-ba_path>/sam-ba.exe -p usb -b sam9x75-curiosity -a nandflash -c erase::0x40000 -c writeboot:boot.bin

7. Change the current directory to <harmony3_path>/bootloader_apps_can/apps/mpu_can_bootloader/bootloader_nand_flash/sam9x75/sam_9x75_curiosity.X/dist/default/production/ and run the below command:

        <sam-ba_path>/sam-ba.exe -p usb -b sam9x75-curiosity -a nandflash -c erase:0x40000:0x80000 -c write:harmony_bootloader.bin:0x40000

8. Reset or Power cycle the device. Green LED will be turned-on to indicate that harmony bootloader code is running on the target.

9. Press the Switch USER on the Host curiosity board to trigger programming of the application binary.

10. Once the programming is complete, Green LED on the Host curiosity board will be turned on indicating success.

11. If above step is successful then target curiosity board will be reset. Upon re-start, the harmony bootloader will jump to the user application.

12. Green LED should start blinking on the target board and you should see below output on the console:

13. 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.

14. 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)

- To bootload any other application refer to the Configuring an application to be bootloaded for MPUs

Rev: C