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.

SPI Flash Bootloading

Other Parts Discussed in Thread: AM3358

Hi Community,

I am trying to interface and Boot load SPI Flash with Sitara Am335x Starter Kit using StarterWare.

There is a utility under "tools" Folder by the name SPI-Flash-Writing which i think can be used for this purpose.

But the problem is, there is no documentation or Guide lines provided  on how to use it. Getting started Guide's section "Booting Via SPI Flash" is vague and i was unable to follow its instructions.

So i want to know if my understanding is correct and is there any Wiki Docs available to seek guidance about this issue ?

Your Help is much appreciated. 

  • Hello Shehrooz,

    If you have CCS installed you can import this project into CCS and build it there. Then you just need to load it through CCS and give path to image you need to flash. I also see prebuild binaries in the tools/flash_writer folder, you can use them if one for your EVM is present.

    Regards,
    Prasad
  • Hi,
    Thank you for the reply.

    Yes i have CCSv6 with 90-Day Evaluation. I have build the SPI-Flash-Write project in CCS using the appropriate settings for Am3358 Starter KIT in project properties.
    Which are

    Configuration : Debug
    Variant : Am3358 Cortex A8
    Connection : XDS100v2 Usb emulator
    Compiler Version GNU TI v5.1.6
    Output Format: eabi (ELF)
    Linker command File AM335x.cmd

    then i loaded this project on to the Starter Kit by start debuging. it shows me the debug interface but nothing really happened after that.

    I have a serial port monitor connected to the UART of Am3358 Starter KIT but nothing shows up there.

    I am not sure how to load this project through CCS other than the way i mentioned above.
    and I am not sure where to give path of these binaries other than Uart (serial port terminal) .

    Please correct me if i am wrong!

    Your Help is much appreciated....!
  • Hello Shehrooz,

    To load binary into cortex A8 in CCS after launching CCXML put your mouse pointer to cortex A8 core and click on load menu (highlighted below), browse project, and point to binary you have just created. After load completes cortex A8 should wait in main(). After this just click on run to start flashing process.

    To see correct output on UART terminal you have to configure baud rate etc. which i hope you are doing.

    Regards,

    Prasad

  • Yes i just figured it out but according to this thread "e2e.ti.com/.../193745"

    CCS will prompt you to Enter the location of binaries. That's why i was confused.

    The process of flashing as you have mentioned above is going to run 2 times , once for bootloader image (bootloader_ti.bin) and the next time for Application image (app_ti.bin) .

    Please correct me if i am wrong...?

    Thank you for your help!
  • I am doing exactly the same on CCSv6, after browsing for binary file "boot.out" and providing the code offset and data offset : 0x00000

    The program stayed there and nothing shows up and how can i resume (or run to start) the program if it is already running ?

    one more thing do we have to "connect to target" in the debug window before flashing or SPI Flash should appear under Cortex A8 tree?
  • You do have to connect to target before loading. Also you dont need to give code and data offset, keep it blank. Once it reaches main/entry point CCS will halt core and you should be able to see it in debug window.

  • Thank you.

    Yes, for the first time after executing the code CCS Halts in main/entry point .  Then i load the boot.out file as you have mentioned above without any data or code offset because it doesn't allow it.  It only allows .out file type (boot_ti.bin gives error).

    At this stage if i press  run to start,  it doesn't halt for the second time and nothing really happens.

    On the other hand if i load both files boot.out and GPIO_card_detect.out together on the first Halt in main and then press run to start the flashing. Then the application start running and shows output at  Uart port monitor. By Loading this way

    But the problem is it does not boot up second time or after that when i restart the Starter Kit or Press warm-Reset......!

    The following is the interfacing which i have used to interface W25Q64FV with AM335x Starter KIT on SPI-0 ZigBee Header.

    I did not change any configuration for SPI register  because it would not make any sense as we are trying to boot our application from it. Bootstrap pins of starter Kit supports SPI-0 booting by default, so no change there as well.

    The StarterWare Version i am using is 02_00_01_01.

    I have Reached up to that point where SPI Flash Program Halts in Main and target is successfully connected .

    Please guide me,

    Which binary files of bootloader and StarterWare Application we have to use ? and do we have to rename them like we do for MMC/Sd booting (MLO, app) ?

    When to load Boot file and when to load application Binary file? What is the Deal with Code and Data offset, why they are disable while the Getting Starter Guide Clearly States that  0x00000 and 0x20000 are the offsets that we have to provide ... ?

    "

    "

    Is there any WIKI page or Application Note documents available to guide me about the steps of this process ?

    Please help me, i am stuck Here since the Last week?

  • Well it Looks like .Gel file mentioned in Getting Started Guide is being load on the Starter KIt through the configurations and we have to provide "spi_flash_writer_AM335x.out" when the program Halts in main.

    When i try to load the "spi_flash_writer_AM335x.out" file it gave the following Error,

    Am335x Part Detected...

    SF: Got ID code EF 40 18

    Checking if winbound flash writer can be used....

    SF: Unsupported  Winbound Id 4018

    No known serial flash found

    and exit...!

    i don't understand why this ID is unsupported even if the interfaced flash is from Winbound  W25Q128FV  ?

    I have tried two different SPI flashes  W25Q128FV (Winbound) but the issue persist ....

    Please Guide me in this regard.

    Your Help is much appreciated....!

  • Hi,

    I have modified the SPI Flash writer code in CCSv6 for Sitara AM3358 Starter KIT and Now i am able to execute SPI Flash writer code, successfully, for W25Q128FV (winbond SPI Flash - 16 Mbyte) flash (which is not supported otherwise).

    I run the utility   to load "Boot_ti.bin file" (which is build for the SPI boot) at 0x00000 location for the first time and after successfully erasing and writing boot loader image, this utility ends without asking about the application binary file (starterWare application image file).

    So i have no choice but to run the code a second time. At this instance i load the "application_ti.bin" file at 0x20000 location and SPI writer code ends after successfully erasing, writing and verifying the data content.

    After successfully writing boot and application image files at the correct locations,  i disconnected the target from CCS and press Warm-Reset  or restart the  AM3358 Starter KIT while hoping that it will boot from the SPI.

    The problem is, nothing Really happens after restarting the board, it seems there is some kind of problem that is restraining the Starter Kit from (SPI Flash)  Booting?

    Note: I am using the  SPI Flash writer code instead of the given binary files "spi_flash_writer_AM335X.out"

    Any kind of help is greatly appreciated....!

  • Shehrooz,

    Please see this board bring-up guide http://processors.wiki.ti.com/index.php/AM335x_board_bringup_tips.

    The SK boot sequence should be MMC0, SPI0, UART0, USB0 and you have the SPI device on SPI0 (Zigbee header)? (sheet 6 of the SK sch http://processors.wiki.ti.com/images/a/a2/TMDSSK3358_3H0009_REV1_2B_SCH.pdf and wiki http://processors.wiki.ti.com/index.php/AM335xStarterKitHardwareUsersGuide#Boot_Configuration ) 

    If you scope the SPI0 bus in boot, do you see any activity?

    Does renaming the application_ti.bin to app and flashing help?

    Lali

  • Thank you for your reply,

    i did not modify any BOOT_SYS pins so SK boot sequence is exactly as you have mentioned. Yes SPI is connected on the Zigbee header of Am335x Starter Kit.

    I Scope the SPI0 Bus on chip select (CS0) pin, after each warm reset CS0 goes to zero logic which is the expected behavior as CS0 is Active-Low.

    Changing name of the binary files "Boot_ti.bin" to MLO or "app_ti.bin" to app  does not help.

    SPI initializing Section of the AM335x TRM states that

      so my question is do i have to take care of the endian conversion or The SPI_Writer_Tool already take care of it ?

    If i have to do the endian conversion while writing the SPI Flash than please guide me in detail. The TRM states we have to write SPI flash in big endian while my understanding is to write the SPI flash in Little Endian as our AM3358 is little endian to avoid endian conversion. Please correct me if i am wrong and guide me further !

    From the above TRM's statement, my understanding is it does not matter in which endian format you write the SPI Flash, At boot time the processor take care of endian conversion at the cost of boot time (performance ). please correct me if i am wrong.

    Best,

    Shehrooz 

     

  • i have read the board bring-up guide and Flash is connected on the Zigbee header, I have also reviewed schematics and Boot configuration files. But no help, everything seems to be okay.

    I scoped the SPI0 CS pin it is going low as expected on boot up (as it is Active-Low) and renaming the application file does not help.

    So please guide me is there a possibility that Boot Loader code in Processors ROM is preventing booting from the unsupported SPI Flash or there is something else causing this problem, ?

    secondly, is there any Code difference between the spi_flash_writer.out file and SPI_FLASH_Tool source code provided in the starterWare...!

    Any  suggestions are warmly welcomed .... ?