SAM9X60-EK Evaluation Kit - Booting from SD Memory Card

Last modified by Microchip on 2024/06/20 12:44

Introduction


In this training, you will configure and program the SAM9X60-EK evaluation kit to boot from an external SD memory card. You will write a pre-built image to an SD memory card using the SAM-BA® In-System Programmer (ISP). The image will contain the second-stage bootloader at91bootstrap, third-stage bootloader u-boot-at91, u-boot environment, the Flattened Image Tree (FIT) (containing the Linux® kernel and Device Tree), and Root File System (RFS).

Steps:

  • SAM-BA ISP
  • Write Image to SD memory card
  • Boot from SD memory card

Prerequisites


Hardware


SAM9X60-EK evaluation kit

For this training, you will use the SAM9X60-EK. You will also need two USB Micro-B cables. One cable will connect the Host PC to the target console to view the SAM-BA Monitor log message. The second cable will connect the Host PC to the target USBA port (J7) so the SAM-BA Host can communicate with the SAM-BA Monitor.

Bootable Memory

The SAM9X60-EK has an SD memory card slot (J4) where you will insert your SD memory card after flashing an image to it. In this training topic, you will use the SAM-BA ISP to write the image to the SD memory card.

SAM9X60-EK SD memory card slot

SAM-BA In-System Programmer


In this section, you will load the SAM-BA Host Application (if you have not already done so) and setup Console and SAM-BA Host to Monitor communications.

Setup SAM9X60-EK Console Serial Communications

To view the SAM-BA Monitor log messages, setup console serial communications following the instructions in the topic: SAM9X60-EK Console Serial Communications

You have two choices in connecting to a serial port on the SAM9X60-EK:

  • The first is using a USB cable to connect to the J-LINK-OB port (J22). This method has the added benefit of powering the SAM9X60-EK.
  • The second is using a USB-to-TTL converter to connect to the Universal Asynchronous Receiver Transmitter (UART) Debug port (J24). With this option, to power the SAM9X60-EK, you will need to:
  • Use an external 5 VDC power supply connected to J1 (coaxial power jack), or
  • Use a USB cable connect to the USBA port (J7). As you’ll be connecting a USB cable in Step 3 below (SAM-BA Host to Monitor Communications), this is the easiest method.

J-LINK-OB port

Information

Note: Operation of the J-Link Debugger will be displayed by a green LED (D9).

Serial UART Debug Port


If it is not already installed, install the SAM-BA Host Application.
Information

Note: SAM-BA ISP should be added to the system PATH variable.

$ export PATH=$PATH:<path_to_sam-ba>

This will enable you to access the SAM-BA ISP from anywhere on your system.


Setup the SAM-BA Host to Monitor Serial Communications

To communicate with SAM-BA Monitor on the target, you must have installed the SAM-BA Host on a Linux PC (Step 2 above), and connect a USB Micro-B cable from the host PC to the USBA port (J7) on the SAM9X60-EK as shown in the following figure (Figure: SAM-BA Host to Monitor Serial Communications).

SAM-BA Host to Monitor Serial Communications
 

Information

Note: You may power the SAM9X60-EK one of two ways:

  1. Using an external 5 VDC power supply connected to J1 (coaxial power jack), or
  2. Using a USB cable connect to the USBA port (J7).
Ensure there is no SD memory card inserted in slot J4.

Close the DIS_BOOT (J13) jumper.

Closing this jumper prevents booting from external memories such as QSPI and NAND Flash.

Press the Reset button (SW3).

Observe ROMBoot on the Console (terminal emulator) indicating the SAM-BA Monitor is running


Write Image to SD Memory Card


In this section, you will download a demonstration image from the Linux4sam website and write the image to an SD memory card using the SAM-BA ISP.

Download the SAM9X60-EK demonstration image from the Linux4SAM website.

The latest demonstration images for the SAM9X60-EK are available on the Linux4SAM website.

There you will find three sets of images created from one of three Build Systems:

  • The Yocto Project
  • Buildroot
  • OpenWRT

Any of the images can be used for this step. If you are undecided, choose the linux4sam-buildroot-sam9x60ek-headless file and extract the image.


Insert a SD Memory Card into slot (J4).
Information

Note: The SD memory card size should be 1 GB or greater.

SD Memory Card


Write the demo image to SD Memory Card.

Execute the following command in the command window (command line interface):​

$ sam-ba -p serial -b sam9x60-ek -a sdmmc -c write:linux4sam-buildroot-sam9x60ek-headless-2020.04.img
Opening serial port 'ttyACM0'
Connection opened.
Detected memory size is 7948206080 bytes.
Page size is 512 bytes.
Buffer is 9728 bytes (19 pages) at address 0x0030a840.
Executing command 'wrie:linux4sam-buildroot-sam9x60ek-headless-2020.04.img'
Wrote 9728 bytes at address 0x00000000 (0.00%)
Wrote 9728 bytes at address 0x00002600 (0.00%)
..
..
Wrote 9728 bytes at address 0x410fe000 (100.00%)
Wrote 8192 bytes at address 0x410fe000 (100.00%)
Connection closed.

Boot from SD Memory Card


Check that:

  • Console serial communications are working properly,
  • The SD memory card is inserted into slot J4, and
  • Ensure the DIS_BOOT jumper (J13) is CLOSED. This will prevent the MPU from booting from QSPI or NAND Flash memory.

Alert! The Disable Boot mechanism of Jumper J13 does not disable booting from the SD memory card. The user must remove the SD memory card to prevent booting from it.

With all preparations completed, press the Reset button (SW3).

Observe:
  • The Linux boot log on the Console (terminal emulator).
  • At the end of the boot sequence, a command line prompt will appear.
    • Log in as "root",
    • There is no password required.
  • The Linux operating system heartbeat is displayed on RGB LED (LD1) as a flashing blue light.

Linux boot log on the Console

Congratulations! You have booted an embedded Linux system on the SAM9X60-EK evaluation kit using an SD memory card as external mass memory.


Summary


In this training, you prepared a Host PC to run the SAM-BA ISP, connected the Host PC to the SAM9X60-EK evaluation kit (the Target), and flashed a demonstration image to an SD memory card using the SAM-BA ISP. Finally, you booted the Linux operating system on the SAM9X60-EK.

What's Next?