This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3352: boot from external SPI flash

Part Number: AM3352

Hello,

I have a customer trying to enable spi flash boot on a custom board. The board is able to boot successfully from other interfaces such as MMC/ SD card. So far the customer has been able to get the AM3352 to load MLO from SPI flash, but is unable to get MLO to find and load U-boot. Based on the documentation from the SDK there's no defconfig option for spi boot for AM335x. What's required to enable support for SPI boot in the u-boot config? It looks like all the drivers are there, but the commands aren't present in u-boot itself.

Munan

  • Hello,

    I'm the customer. When I try to boot using SPI flash, I see the messages:
    SPL: Unsupported Boot Device!
    SPL: failed to boot from all boot devices
    ### ERROR ### Please RESET the board ###

    I've been diagnosing the issue with some additional debug output in u-boot-ti-staging\common\spl\spl.c
    Output from the routine spl_ll_find_loader shows there is no bootable device that contains "spi". The list include MMC1, MMC2, MMC2_2, NAND, "eth device", "USB eth", and "UART".
    Output from the routine boot_from_devices shows trying to boot from device #8 "MMC1" when the SD is inserted and device #11 NULL when the SD card is removed.

    When I boot from an SD card, from the uboot command line I tried the "sf probe 0" command. The result is:
    Failed to initialize SPI flash at 0:0

    I can update the MLO executable in SPI flash, so it's probably configured correctly. Based on the debug output my best guess is MLO doesn't know about SPI flash.

    We're using a Spansion s25fl216k. It's possible the device tree and/or pin mux aren't completely correct.

    Is there perhaps a list of changes needed to enable booting from SPI flash?

    Thanks,
    Scott

  • Hi Scott,
    Due to limited on-chip SRAM size for SPL on AM335x, it is almost impossible to have complet boot mode support in one default config in u-boot build. There used to be a separate config, i.e. <am335x_evm_spiboot_defconfig> for building u-boot for booting SPL/u-boot from SPI on AM335x EVM. Is there <am335x_evm_spiboot_defconfig> in your u-boot tree?
    Best,
    -Hong

  • Hi Hong,

    We're using processor-sdk-06.03.00.106. The only "spiboot" file I see is am43xx_evm_qspiboot_defconfig. There's nothing for the am335x.

    I've added several lines to our defconfig:
    CONFIG_SPI_BOOT=y
    CONFIG_SPI_LOAD=y
    CONFIG_SPL_SPI_LOAD=y

    The SPL boot devices now contain "SPI". Now when I try to boot, I see these messages:
    Trying to boot from SPI
    SPI probe failed.
    SPL: failed to boot from all boot devices

    The SD card as removed, so MLO was obviously loaded from SPI flash. However, MLO can't see the SPI flash and/or can't find u-boot.img.

    Do you have any suggestions?

    Thanks,
    Scott

  • Hi Scott,
    I just checked SDK 6.3 (u-boot 2019.01), and you're right <am335x_evm_spiboot_defconfig> is not included for some reason.
    It looks like <am335x_evm_spiboot_defconfig> is in the recent SDK 7.3 (u-boot 2019.01).
    software-dl.ti.com/.../index_FDS.html
    Best,
    -Hong

  • correction on typo: recent SDK 7.3 (u-boot 2020.01)

  • Hi Hong,

    I downloaded that 7.3 SDK and I've been reviewing am335x_evm_spiboot_defconfig.

    After adding diagnostic output, it appears MLO doesn't find the SPI flash / "jedec,spi-nor" driver.

    Is there any troubleshooting documentation available?

    Thanks,
    Scott

  • Hi Scott,
    I built u-boot with <am335x_evm_spiboot_defconfig> using AM335x SDK 7.3, and I'm attaching two log files captured on AM335x GP EVM for your reference:
    1. am3_7.3_spi_flash.txt: spi flashing log for spi flashing booting from MMC card.
    Note that
    - I used MLO/u-boot.img default build from SDK6.3 for MMC boot. It seems there's an issue using "sf probe 0" @u-boot when I was using the MLO/u-boot.img default build from SDK7.3
    - SPL flashed images are built with <am335x_evm_spiboot_defconfig> from SDK 7.3: MLO.byteswap, u-boot_spi.img (renamed from u-boot.img).
    2. am3_7.3_spi_boot.txt: spi booting log

    Hopefully this helps you enabling SPI on your board.
    Best,
    -Hong

    am3_7.3_spi_flash.txt
    => sf probe 0
    SF: Detected w25q64cv with page size 256 Bytes, erase size 4 KiB, total 8 MiB
    => sf erase 0 +100000
    SF: 1048576 bytes @ 0x0 Erased: OK
    => fatload mmc 0 ${loadaddr} MLO.byteswap
    40504 bytes read in 6 ms (6.4 MiB/s)
    => sf write ${loadaddr} 0 ${filesize}
    device 0 offset 0x0, size 0x9e38
    SF: 40504 bytes @ 0x0 Written: OK
    => fatload mmc 0 ${loadaddr} u-boot_spi.img
    772416 bytes read in 69 ms (10.7 MiB/s)
    => sf write ${loadaddr} 0x20000 ${filesize}
    device 0 offset 0x20000, size 0xbc940
    SF: 772416 bytes @ 0x20000 Written: OK
    => 

    am3_7.3_spi_boot.txt
    U-Boot SPL 2020.01-dirty (Jun 25 2021 - 16:20:09 -0500)
    Trying to boot from SPI
    
    
    U-Boot 2020.01-dirty (Jun 25 2021 - 16:20:09 -0500)
    
    CPU  : AM335X-GP rev 2.1
    Model: TI AM335x EVM
    DRAM:  1 GiB
    WDT:   Started with servicing (60s timeout)
    NAND:  0 MiB
    MMC:   OMAP SD/MMC: 0
    Loading Environment from SPI Flash... Invalid bus 0 (err=-19)
    *** Warning - spi_flash_probe_bus_cs() failed, using default environment
    
    <ethaddr> not set. Validating first E-fuse MAC
    Net:   Could not get PHY for ethernet@4a100000: addr 0
    eth0: ethernet@4a100000
    Warning: usb_ether MAC addresses don't match:
    Address in ROM is          de:ad:be:ef:00:01
    Address in environment is  1c:ba:8c:f0:79:11
    , eth1: usb_ether
    Hit any key to stop autoboot:  2  0 
    => 

  • Hi Hong,

    I finally got everything to work with the 6.03 sdk by adding these lines to my defconfig:
    CONFIG_SPI_BOOT=y
    CONFIG_SPL_SPI_LOAD=y
    CONFIG_SPL_OS_BOOT=n
    CONFIG_SPI_FLASH_MACRONIX=y
    CONFIG_SPI_FLASH_SPANSION=y
    CONFIG_SPI_FLASH_USE_4K_SECTORS=y

    I found those config statements by following the error messages in the MLO source code and determining what was missing.

    Thanks,
    Scott

  • Hi Scott,
    It is very good to know you were able to make QSPI boot work on your setup.
    Thanks for sharing the changes based off SDK6.3 which will benefit other users.
    Please move the ticket to "resolved"!
    Best,
    -Hong