How To Boot DM368SOC from SPI NOR Flash Memory Device on Leopardboard368


Background

According to DM368 SoC technical document (SPRUFG5A), DM368 SoC supports booting from NAND, MMC/SD, UART, USB, SPI, EMAC and HPI (Host Processor Interface). By the time of writing this tutorial, it seems that TI only officially supports booting from NAND device, MMC/SD card and UART port in their DM368 DVSDK release.

In our case, we don't have NAND memory on board and nor do we support wired Ethernet connection (we do support WiFi over USB or SDIO interface). The SD card is only used for storing user data and it can not be used as a boot device as the product doesn't ship with a card! We don't want to UART or USB port for booting since it is really not practical for a product in the field.

SPI booting seems ideal to us and the only way for us to boot DM368 SoC.

Once the boot mode is identified, the next question comes in: "how do I flash the SPI (or NAND if you have one board) memory device?". We could use MMC/SD card to boot and then program a memory device and actually it is the "de-facto" way most people use nowadays. We landed at using the USB boot as it is more mass production friendly and speedier. Luckily we were able to get the USB boot working with the help from TI[a] . As a result, we wrote an app to boot DM368 SoC via USB and flash the memory devices.

When booting from SPI device, DM368 SoC will look for a UBL stored in the SPI device attached to SPI0 interface. We have created the SPI UBL binary for you to download. We will show you the download links while you read through this tutorial or you can simply jump to the Downloads section if you can't wait.

Hardware Prerequisites

  • Leopardboard368 EVM Board
  • In this tutorial, we will use a Leopardboard368 EVM from Leopard Imaging, Inc.

  • SPI NOR Flash Memory Add-on Card
  • Leopardboard368 is a well designed, feature rich and yet low-cost DM368 EVM Board. It does not have an SPI NOR Flash memory device on board though. Fortunately, all SPI0 signals (SPI0_CS0, SPO0_SCK, SPI0_SIMO, SPI0_SOMI) are brought out to the connector J8, adjacent to the JTAG connector. In this tutorial, we will use this SPI NOR Flash Memory Add-on Card designed specifically for Leopardboard368. It has an 8MB SPI NOR Flash memory device from Windbond, a 16KB I2C EEPROM memory device from Microchip and a microSD card socket. (We don't cover I2C in this tutorial)

    A header needs to be soldered onto Leopardboard368 in order to receive the add-on card. See picture below.

    Software Prerequisites

  • pikutilDM368
  • A host app for booting DM368 Soc via USB and flashing SPI NOR Flash memory device. Currently it supports Mac OS X 10.6 or later. It is available for downloading in the Downloads section. (Note: its support for Ubuntu Linux will be coming soon.)

    pikutilDM368 has the following fixed SPI NOR memory start addresses:

    Image TypeStart AddressMax. Allowable Image Size
    UBL SPI0x00000064KB
    UBOOT0x010000448KB
    KERNEL0x0A0000up to 7.375MB

  • SPI UBL binary image
  • It needs to be flashed into the SPI NOR Flash memory device for SPI booting. When downloading it, choose a variant to meet your need for the ARM and DDR speeds. For example if you intend to run ARM at 297MHz and DDR memory at 243MHz and use 24MHz crystal on Leopardboard368, you should download ubl_DM36x_spi_ARM297_DDR243_OSC24.bin image.

  • uboot binary image
  • You can download a prebuilt uboot binary image (2010.03) specifically ported to Leeopardboard368 or try your own. Stay tuned for a tutorial on how to port uboot to Leopardboard368.

    Step-by-step Walk-through

    1. Connect Leopardboard368 to the host computer via a USB cable. Make sure Jumper J1 is open and J4 is on 1-2 as we want DM368 to be a USB peripheral device. Also connect the console serial port cable.

    2. Set DIPSW1 switch to 100 (USB Boot Mode) On Leopardboard368.

    3. Run pikutilDM368 app on the host computer.

    4. Power up leopardboard368 and press its reset button. Now pikutilDM368 detects DM368 SoC device and automatically downloads the USB UBL binary into its TCM for execution. Once the USB UBL gets executed, pikutilDM368 will say "found usb device (Pico DM368SOM Loader)" as shown below.

    The follow messages will also be printed out on the serial port console:

     initialization passed!
    TI UBL Version: 1.50 (Oct 25 2011 - 12:22:04)
    Booting Catalog Boot Loader
    BootMode = USB download mode started ...
    
    Copyright (C) 2011 Pico Instruments LLC. All rights reserved.
    Pico Flash Agent, $Revision: 1.00 $ built on $Date: 2011-10-21 07:07:55 $.
    Disconnecting ... done.
    Reconnecting ... done.
    USB Flash Agent started.
    

    5. To ensure the USB Flash Agent is already started (in case you don't have a console connected to see the printed messages), you can check the "turn on led" checkbox and the two LEDs on the Leopardboard368 will be lit up.

    6. Now, select the image type from the drop-down list, and click "Flash Now" button to navigate to the binary image file you want to burn into the SPI NOR Flash memory device. Please note, pikutilDM368 currently only supports flashing SPI0 device. We will add support for SPI1 device and NAND devices later.

    7. Once you have all the necessary binary images (ubl, uboot, ...) burned into the SPI0 device, you can click "Reset Target" button to instruct DM368 SoC to boot from the SPI0 device. At this time, you can still leave Set DIPSW1 switch set to 100 (USB Boot Mode) as the "Reset Target" action simply copies the uboot binary stored in the SPI0 device into the DDR memory and execute it with ARM running at 432MHz and DDR memory running at 340MHz (they were set by the USB UBL). If you intend to run different speeds, you should power-cycle the target board instead.

    8. Last and important step, set DIPSW1 switch to 101 (SPI Boot Mode) On Leopardboard368 so that next time you power cycle Leopardboard368, it won't accidentally end up in the USB boot mode.

    Downloads

    (Disclaimers: all the downloadable materials on this site are provided "AS IS".)

  • pikutilDM368
  • To install, simply unzip the download onto your Desktop. Double-click to run it. Click here to download it.

  • UBL
  • Choose a variant that matches your speed requirement:

    (Note only binary images built for 24MHz crystal on Leopardboard368 were tested).

  • Uboot
  • Built based on 2011.03 version and ported to Leopardboard368 EVM. It's configured to have environment variables stored in the SPI memory device. Click here to download it.

    A tutorial on how to port uboot to Leopardboard368 will be available soon. Please check back frequently.

    References

    [1] SPRUFG5A - TMS320DM36x Digital Media System-on-Chip (DMSoC) ARM Subsystem.
    [2] SPRUFH9A - TMS320DM36x Digital Media System-on-Chip (DMSoC) Universal Serial Bus (USB).
    [3] SPRUFH1B - TMS320DM36x Digital Media System-on-Chip (DMSoC) Serial Peripheral Interface (SPI).
    [4] TMS320DM368 DVDSK 4.02.00.06 Software Release Package.
    [5] USB 2.0 Specification.

    Acknowledgements

    [a] Michael Risley from Texas Instruments.