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.

TMS320F28377S: How to program flash memory via SPI using binary file in F28377S/F280049?

Part Number: TMS320F28377S


I want to update the firmware via SPI.

I want to build a flash binary using CCS. Can anyone tell me how to generate this file?

Then I want to take this file to program the flash memory via SPI. I would follow the steps below, but I don't know if it works.

1. Use the ram function to execute all the steps of flash programming.

2. Initialize the SPI peripheral.

3. Read the binary from SPI and program the all-flash using the FLASH API.

Can anyone tell me how to program the flash memory via SPI in the correct steps?

Thanks

Cody

  • Hello Cody,

    Yes, you can read data from the SPI and program it into flash using the Flash API. My question is this: are you trying to have two different programs side by side in flash in the same device, or are you trying to bootstrap the device using RAM first, and then flash? If you want to have a flash bootstrap and then put another program in a different location in the flash, this is currently not possible as the C28x compiler tools do not support relocatable executables.

    The latter approach should work fine -- for your flash program build options, you need to enable the C2000 Hex Utility, and then select the format you desire. You can use the binary format or any of the hex formats depending on your preference.

    Best regards,
    Ibukun

  • Dear Lbukun,

    Let's say there is a new version of my project and I use Hex Utility to build a binary. I take this file and send it from PC or other processor via SPI. I switch my old project to wait and receive data from SPI before sending this file. My program is as follows:

    1. Jump the custom function in RAM which is used to program Flash.

    2. Disable all interrupts

    3. Initialize Flash()

    4. Initial SPI peripheral.

    5. Imitate CopyData() in F2837xS_sci_flash_kernel, just change getWordData to SPI

    Regarding my steps above, does it work?

    Thanks

    Cody

  • Cody,

    I don't see a reason why this wouldn't work. GetWordData in this example is intended to be a generic peripheral get function so you should be able to implement an equivalent function for SPI and make it work. The SCI function is in SCI_GetFunction.c for reference.

    Best regards,
    Ibukun

  • Dear Lbukun,

    I would implement the SPI receive function instead of sciaGetWordData. For all programs like "uint32_t sciBoot(uint32_t BootMode)", I would copy sciBoot to a new function of spiFirmwareUpdate(), I just replace the internal function of sciaGetWordData with spiaGetWordData. After I implement this function, if I need to do a firmware update, I will use C2000 Hex Utility to build a binary file, and then use USBtoSPI to send this file. Use spiFirmwareUpdate() to receive this file and do the procedure of updating the flash. So I would like to ask you, is such a process working properly?
    My English is poor, thank you for your patience in helping me.

    Cody

  • Cody,

    Yes, I don't see a problem with your planned approach. It should work.

    Best regards,
    Ibukun

  • Dear Lbukun,

    I'm building the tool on a PC base and creating the receive function on the C2000. During this time, I would worry that I was wrong. Therefore, I want to make sure that the idea is correct and feasible.

    Thanks

    Cody