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.

Firmware Update from SD via SSI

Hi,

My device handle an SD.

Is it possible to update the firmware from SD via SSI?

What do the functions in Section 35.4 of the Peripheral Controller Library do?

What do the functions in Chapter 3 of the TivaWare Boot Loader User Guide do?

Is it possible to use boot_demo1 with boot_serial on an SD via SSI? Without having to use the LM Flash Programmer

Thanks in advance

Andrés

  • Hello Andres

    Are you looking for the SD Card boot as given in the software example of the following TI Design?

    www.ti.com/.../TIDM-TM4C129SDRAMNVM
  • In my application I have a TM4C123G connected with an microSD via SSI. I'm not sure if that software example is for my application.

    Basically i want the TM4C123G to be able to detect/read *.bin file from a microsd and execute a routine that allows it to update its firmware
  • Hello Andres

    The software example is not one-to-one for TM4C123x. However you may still use the same to upload a binary to the flash (instead of the SDRAM).
  • I am a little confused. I have some questions:

    I have to modify the bootloader to update the firmware?

    How to compile the usb_boot or serial_boot example?

    If I modify the usb_stick_update example, I have to modify the bootloader?

    Should I use ektm4c129_sdcard_bootloader and usb_stick_update combined?
  • Hello Andres

    The TI Design example code uses ektm4c129_sdcard_bootloader to copy the data to SDRAM. Instead of that you would need to flash the code to Internal Flash. Since the example is for TM4C129x, you would need to make some changes for the TM4C123x as given in the migration guide.
  • Excuse me, but is there a migration guide?

    Could you please give me the link?

    Thanks in Advance
  • Hello Andres

    Please refer to the following Application Note.

    www.ti.com/.../spma065.pdf
  • Finally after reading the documents I could do a project that reads a file from a sd card.

    The steps to update the firmware are as follows:

    * My program detects if "firmware.bin" exists in the SD
    * Is it a new version?
    * Copy the file of the new version to an external SDRAM.
    * Reset
    * Bootloader reads if there is a "something" in the SDRAM and if it is a new flasheable version
    * Copy the new code to the memory location APP_BASE
    * Reset
    * Bootloader does not find a new version, jumps to the default APP_BASE position


    Is it possible to do the above steps? Especially the items related to the bootloader

    Is the bootloader always running from the SDRAM?

    What is the bootloader folder in the TIVA directory?

    Regards,
    Thanks in advance
  • Hello Andres

    TM4C123 does not have SDRAM interface. The boot loader does not run in SDRAM but on the on-chip flash. The boot loader directory in TivaWare is the set of files required to implement a boot loader to use UART, I2C, SPI, USB or CAN as boot loader interface from an external host or device. It does not have code for implementing a FAT File System.

    The steps listed must be

    * My program detects if "firmware.bin" exists in the SD
    * Is it a new version?
    * Copy the file to a new location in Flash which is sector aligned at APP_BASE2
    * Update a Flag in the Non Volatile memory like EEPROM for the new application image
    * Erase the existing application at APP_BASE1
    * Jump and execute application at APP_BASE2
  • Thanks for your answer.

    Sorry, I meant an external flash memory SPI, instead of SDRAM.

    I thought using your solution, but in that case my program should occupy at most half of my internal flash memory.

    is it possible with an external flash memory SPI?
  • Hello Andres

    No, external SPI Flash cannot be used as we do not support XIP SPI controller.

    The above example can be simplified by using only one APP_BASE+BootLoader. The boot loader shall always erase the APP_BASE when it detects a firmware.bin whose version is greater than current firmware version.
  • ok I understand

    Sorry for insisting, but how can I create my own bootloader?

    I want to use the boot_serial example, but I don't have a main. I think I'm conceptually wrong.

  • Hello Andres

    A boot loader is a method to bring in an application image. You can use an existing project like the SD Card Flasher in the TI Design pointed earlier and use the same as boot loader.
  • Hello Amit,

    How should I set the project properties to compile and debug my bootloader project?

    Thanks
  • Hello again,

    My project reads update.bin (loads it into RAM) from an SD with FATFS.
    Then I delete all the contents of the flash and copy update.bin in position 0x2800
    I use CallApplication to jump to that starting position of the program.
    But fails in __asm ("ldr sp, [r0] \ n"

    Should I configure something in startup.c or .cmd?
  • Hello Andres

    Does the Flash at the location 0x2800 contain the same data as the application image?
  • I finally made it work. The problem now is that it is copied too slow. Is this due to the ssi bitrate or the fatfs? Any suggestion?
  • Hello Andres

    What is the SSI clock rate currently set as in the Fat File system porting file and what is the system clock frequency?
  • ssi clock rate

    SSIConfigSetExpClk(SSI0_BASE, ROM_SysCtlClockGet(),SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 400000, 8);

    and system clock frequency

    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
  • Hello Andres

    You can update the system clock for 80MHz using

    ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

    And increase the SD Card clock rate to 1 MHz from the current 400 KHz (to start with and then see till what speeds you can get reliable data)

    SSIConfigSetExpClk(SSI0_BASE, ROM_SysCtlClockGet(),SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
  • Thanks,
    now i have another question:
    Before performing the upgrade by jumping to the bootloader (before erase the flash), I need to check the CRC of the new firmware.bin directly from the SD card.
    Any idea how to do this?
  • Hello Andres

    You would need to create a CRC tool to compute the CRC on the file and append it to the end of the file on a standalone host like PC. In the boot loader software you can then perform the same check on the file b y reading it to establish its correctness before updating the SP and PC locations in the application space.
  • Can I adapt CheckImageCRC32?