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.

using SPI in the EVM

hi,

i have the EVM with the touch screen.

i'm using SDK 05.05.00.00.

when i'm starting u-boot i want to use the comand to connect SPI to the NOR flash.

this is the line i want to run: sf probe 0x0

and this is what i get:

 SF: Unsupported manufacturer ff

 Failed to initialize SPI flash at 0:0

can someone help me with this?

my plan is to burn the NOR flash with u-boot. but currently i can not even access the SPI...

thanks in advance :-)

  • Hi Eliah,

    Please refer to the following link: http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#SPI_2

    SPI

    Note

    • This feature is not supported prior to PSP 04.06.00.08 (and AMSDK 05.05.00.00).
    • This feature changed kernel location and filenames with PSP 04.06.00.09 (and AMSDK 05.06.00.00).
    • The release package does not contain the binary for SPI boot. Please follow the steps mentioned here for compiling u-boot and use the MLO.spi and u-boot.bin files that are produced.
    • Following those same instructions but building for am335x_evm_spiboot rather than am335x_evm will result in binaries that will use the SPI flash for environment rather than NAND.

    In this example we initially boot from an SD card and use that to transfer the files to write to SPI flash. If loading via other methods, modify the commands below.

    1. Switch ON EVM with switch settings such that SPI is present and boot via non-SPI. See SPI boot for more information.
    2. Write it to SPI memory by executing the following commands:
    U-Boot# sf probe 0
    U-Boot# sf erase 0 +80000
    U-Boot# mmc rescan
    U-Boot# fatload mmc 0 ${loadaddr} MLO.byteswap
    U-Boot# sf write ${loadaddr} 0 ${filesize}
    U-Boot# fatload mmc 0 ${loadaddr} u-boot.img
    U-Boot# sf write ${loadaddr} 0x20000 ${filesize}
    

    Best regards,
    Miroslav
  • hi Miroslav,

    thanks for your answer, but i know this page. this is what i was trying to do and in the first line of:
    sf probe 0

    i got the error i mention in my first post. what can i do with this?

    thanks :-)

    Miroslav Kiradzhiyski XID said:

    Hi Eliah,

    Please refer to the following link: http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#SPI_2

    SPI

    Note

    • This feature is not supported prior to PSP 04.06.00.08 (and AMSDK 05.05.00.00).
    • This feature changed kernel location and filenames with PSP 04.06.00.09 (and AMSDK 05.06.00.00).
    • The release package does not contain the binary for SPI boot. Please follow the steps mentioned here for compiling u-boot and use the MLO.spi and u-boot.bin files that are produced.
    • Following those same instructions but building for am335x_evm_spiboot rather than am335x_evm will result in binaries that will use the SPI flash for environment rather than NAND.

    In this example we initially boot from an SD card and use that to transfer the files to write to SPI flash. If loading via other methods, modify the commands below.

    1. Switch ON EVM with switch settings such that SPI is present and boot via non-SPI. See SPI boot for more information.
    2. Write it to SPI memory by executing the following commands:
    U-Boot# sf probe 0
    U-Boot# sf erase 0 +80000
    U-Boot# mmc rescan
    U-Boot# fatload mmc 0 ${loadaddr} MLO.byteswap
    U-Boot# sf write ${loadaddr} 0 ${filesize}
    U-Boot# fatload mmc 0 ${loadaddr} u-boot.img
    U-Boot# sf write ${loadaddr} 0x20000 ${filesize}
    

    Best regards,
    Miroslav

    [/quote]

  • Hi Eliah,

    I see you mentioned that you are using SDK 05.05.00.00:

    Eliah Ninyo said:
    i'm using SDK 05.05.00.00.

    Perhaps you missed this part of the link posted above:

    This feature is not supported prior to PSP 04.06.00.08 (and AMSDK 05.05.00.00).

    Please try again with the newer version of the SDK (05.06.00.00) and update the topic with the results.

    Best regards,
    Miroslav
  • hi,

    i downloaded the latest SDK 05.06.00.00.

    i run this line:

    make O=am335x CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm am335x_evm_splboot

    and got this:

    make: *** No rule to make target `am335x_evm_splboot'.  Stop.

    but this line is working properly:

    make O=am335x CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm am335x_evm

    what should i do?

  • Hi Eliah,

    You have a type-o in your target name. You have written "am335x_evm_spLboot" but it should be "am335x_evm_spiboot".

    Best regards,
    Miroslav
  • thanks for the fix :-) i saw L and not i (i guess i need glasses :-))

    anyway, now i get this:

    U-Boot 2012.10 (Feb 20 2013 - 08:38:36)

    I2C:   ready
    DRAM:  512 MiB
    WARNING: Caches not enabled
    NAND:  256 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    SF: Unsupported manufacturer ff
    *** Warning - spi_flash_probe() failed, using default environment

    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0 musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Peripheral mode controller at 47401000 using PIO, IRQ 0
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Host mode controller at 47401800 using PIO, IRQ 0
    Net:   cpsw, usb_ether
    Hit any key to stop autoboot:  0
    Card did not respond to voltage select!
    Booting from nand ...

    NAND read: device 0 offset 0x280000, size 0x500000  
    5242880 bytes read: OK
    Wrong Image Format for bootm command
    ERROR: can't get kernel image!

    U-Boot#
    U-Boot# sf probe 0
    SF: Unsupported manufacturer ff
    Failed to initialize SPI flash at 0:0

  • and this is my envirioment variables:

     

    baudrate=115200
    bootargs=console=ttyO0,115200n8 root=ubi0:rootfs rw ubi.mtd=7,2048 noinitrd rootfstype=ubifs rootwait=1 ip=none
    bootargs_defaults=setenv bootargs console=${console} ${optargs}
    bootcmd=if mmc rescan ${mmcdev}; then echo SD/MMC found on device ${mmcdev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run loaduimagefat; then run mmcboot;elif run loaduimage; then run mmcboot;else echo Cound not find ${bootfile} ;fi;else run nandboot;fi;
    bootdelay=3
    bootenv=uEnv.txt
    bootfile=uImage
    console=ttyO0,115200n8
    dfu_alt_info=SPL part 0 1;SPL.backup1 part 0 2;SPL.backup2 part 0 3;SPL.backup3 part 0 4;u-boot part 0 5;kernel part 0 7;rootfs part 0 8
    ethact=cpsw
    ethaddr=00:18:31:f2:53:7a
    fdtaddr=0x80F80000
    importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize
    ip_method=none
    kloadaddr=0x80007fc0
    loadaddr=0x80200000
    loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
    loadramdisk=fatload mmc ${mmcdev} ${rdaddr} ramdisk.gz
    loaduimage=ext2load mmc ${mmcdev}:2 ${kloadaddr} /boot/${bootfile}
    loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}
    mmcargs=run bootargs_defaults;setenv bootargs ${bootargs} root=${mmcroot} rootfstype=${mmcrootfstype} ip=${ip_method}
    mmcboot=echo Booting from mmc ...; run mmcargs; bootm ${kloadaddr}
    mmcdev=0
    mmcroot=/dev/mmcblk0p2 ro mmcrootfstype=ext3 rootwait mtdids=nand0=omap2-nand.0 mtdparts=mtdparts=omap2-nand.0:128k(SPL),128k(SPL.backup1),128k(SPL.backup2),128k(SPL.backup3),1920k(u-boot),128k(u-boot-env),5m(kernel),-(rootfs) nandargs=run bootargs_defaults;setenv bootargs ${bootargs} root=${nandroot} noinitrd rootfstype=${nandrootfstype} ip=${ip_method} nandboot=echo Booting from nand ...; run nandargs; nand read.i ${kloadaddr} ${nandsrcaddr} ${nandimgsize}; bootm ${kloadaddr} nandimgsize=0x500000 nandroot=ubi0:rootfs rw ubi.mtd=7,2048 nandrootfstype=ubifs rootwait=1 nandsrcaddr=0x280000 netargs=run bootargs_defaults;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp netboot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${kloadaddr} ${bootfile}; run netargs; bootm ${kloadaddr} nfsopts=nolock ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype=${ramrootfstype} ramboot=echo Booting from ramdisk ...; run ramargs; bootm ${loadaddr} ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M ramrootfstype=ext2 rdaddr=0x81000000 rootpath=/export/rootfs spiargs=run bootargs_defaults;setenv bootargs ${bootargs} rootfstype=${spirootfstype} ip=${ip_method} spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read ${kloadaddr} ${spisrcaddr} ${spiimgsize}; bootm ${kloadaddr} spibusno=0 spiimgsize=0x362000 spiroot=/dev/mtdblock4 rw spirootfstype=jffs2 spisrcaddr=0x80000 static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off stderr=serial stdin=serial stdout=serial usbnet_devaddr=00:18:31:f2:53:7a ver=U-Boot 2012.10 (Feb 20 2013 - 08:38:36)

    Environment size: 3197/4092 bytes

     

  • Hi Eliah,

    The general purpose daughterboard of the AM335x EVM has a CPLD on it with connections to the major AM335x signals. A picture of how it looks like is shown in the HW User Guide: http://processors.wiki.ti.com/index.php/AM335x_General_Purpose_EVM_HW_User_Guide#CPLD

    You can set different profiles using the switches. By default it is set to Profile #0 ( switches 1-4: 0000). In order to allow SPI flash boot, you should set the switches to Profile #2 (switches 1-4: 0100) - please refer to the attached Pin Use Assignment .xlsx file at the end of the Functional Interface Mapping section of the HW User Guide. In that file you will find a detailed description of each CPLD profile.

    Best regards,
    Miroslav
  • hi, thanks for that answer!!!

    it was very helpful. after some time i manage to activate the SPI :-)

    i'm so happy!

    but now i have another question:

    i'm booting through UART. and do what needed (send spl with XMODEM and then the image with YMODEM). everything works fine. but the commands in spi are for mmc:

    U-Boot# sf probe 0
    U-Boot# sf erase 0 +80000
    U-Boot# mmc rescan
    U-Boot# fatload mmc 0 ${loadaddr} MLO.byteswap
    U-Boot# sf write ${loadaddr} 0 ${filesize}
    U-Boot# fatload mmc 0 ${loadaddr} u-boot.img
    U-Boot# sf write ${loadaddr} 0x20000 ${filesize}
    
    what should i do if there is no mmc? i booted through UART and got to the U-Boot prompt? how is the command lines changes?
    thanks in advance,
    P.S. i'm asking all those question since i need to check what can be the easiest way for manifucture to first burn the board we develop. the easiest way as i see it to boot from UART and then inject the boot to the SPI NOR flash since this is what will have in the real board (a NOR flash that connected with SPI0 and the SYSBOOT will be that who looks on the SPI). 
    if you have other idea please share.
  • Hi Eliah,

    Please follow these steps in order to flash the SPI memory from UART mode:


    1. Build U-Boot:
    # make O=am335x CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm am335x_evm_spiboot

    2. Save the generated MLO.byteswap and u-boot.img  from the output folder and also the u-boot-spl.bin from the ./spl folder.

    3. Set the EVM switches for UART boot (1-5: 10000)

    4. Boot from UART by sending the u-boot-spl.bin and the u-boot.img files via UART.

    5. After transfer is complete interrupt the boot sequence to enter U-Boot mode.

    6. Flash the SPI memory:

    IMPORTANT: Depending on whether you're using kermit or ymodem mode use one of these two commands to load the image files to RAM:

    loadb   - load binary file over serial line (kermit mode)
    loady   - load binary file over serial line (ymodem mode)

    U-Boot# sf probe 0
    U-Boot# sf erase 0 +80000
    U-Boot# loady 0x82000000
    - (when prompted send MLO.byteswap via UART)
    U-Boot# sf write 0x82000000 0 ${filesize_of_MLO.byteswap}
    U-Boot# loady 0x82000000 -> u-boot.img
    - (when prompted send u-boot.img via UART)
    U-Boot# sf write 0x82000000 0x20000 ${filesize_of_u-boot.img}

    9. Stop the device, set the EVM switches for SPI boot (1-5: 01101) and start the device.

    It should boot from the SPI memory.

    Regarding your second question: Booting from UART and flashing the SPI memory is definitely the easiest way, but keep in mind that it is also the slowest (due to UART speed limitations).

    Best regards,
    Miroslav
  • hi,

    sorry for the delay answer.

    i tried what you wrote me and it looks like it is going to work but nothing...

    this is what is what i did:

    U-Boot# sf probe 0

    SF: Detected W25Q64 with page size 4 KiB, total 8 MiB

    U-Boot# sf erase 0 +80000

    U-Boot# loady 0x82000000

    ## Ready for binary (ymodem) download to 0x82000000 at 115200 bps...

    CCCxyzModem - CRC mode, 0(SOH)/86(STX)/0(CAN) packets, 6 retries

    ## Total Size      = 0x00014f65 = 85861 (Bytes this is the MLO.byteswap file)

    U-Boot# sf write 0x82000000 0 85861

    U-Boot# loady 0x82000000

    ## Ready for binary (ymodem) download to 0x82000000 at 115200 bps...

    CCxyzModem - CRC mode, 0(SOH)/347(STX)/0(CAN) packets, 4 retries

    ## Total Size      = 0x00056550 = 353616 Bytes (Bytes this is the u-boot.img file)

    U-Boot# sf write 0x82000000 0x20000 353616

     

    but after i changed the switch to be SPI boot i get this:

    U-Boot SPL 2012.10 (Feb 20 2013 - 08:38:36)
    SF: Detected W25Q64 with page size 4 KiB, total 8 MiB

    and nothing else happens...

    it seems like it starts from the SPI flash but i dodn't get to the u-boot promt.

     

    any ideas?

  • Hi Eliah,

    When flashing the SPI memory don't use the decimal size of the transfered files. Instead use the hexadecimal size. Example below.

    ## Total Size      = 0x00056550 = 353616 Bytes (Bytes this is the u-boot.img file)

    U-Boot# sf write 0x82000000 0x20000 353616

    Should be:

    sf write 0x82000000 0x20000 0x56550

    Best regards,
    Miroslav

  • thanks!

    this helped me a lot and now it is also working!!!!

     

     

  • Hi,

      Im trying to boot from SPI in am335xevm. Used UART to transfer files. The transfer is complete. After that while I was trying to boot from SPI ,Nothing(no logs) is displayed in my minicom.

    Im using ti-sdk 7.0 pre built images.

    Regards

    Arun J