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.

TMS320F28P659DH-Q1: C2000 microcontrollers forum

Part Number: TMS320F28P659DH-Q1
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hello.

I am not familiar with TI microcontrollers, including the TMS320F28P659, which I am using.  I wish to implement a bootloader that resides in Flash. It is my understanding that the it is possible on this mcu that the bootloader can execute from Flash in bank 0 while erasing and reprogramming a different Flash bank.

Our application will receive a serial command via SCI port A from a Firmware Update program to cause the mcu to reset, and then to invoke the bootloader directly in Flash boot mode. We have an issue with the hardware because the hardware has been hardwired so the default SCI boot pins are not able to be read by the boot loader to know what mode it should boot in, which is why it will boot directly into Flash boot mode. We are only using CPU1, so I don't have to involve it in the bootloader. The internal bootrom will start the bootloader running from Flash, and it will validate the application in Flash and execute it from Flash, or receive it will receive a command to start a firmware update, at which time it will jump to the flash kernel executing from Flash in Flash Bank 0.

There are 5 banks of Flash on the device we are using assigned to CPU1 (0-4). I want to use bank 0 to contain the bootloader code. Bank 1 will be allocated to the application. So far the application fits in a single bank.

In our setup, the normal boot procedure would be to boot to the application running from Flash in bank 1. The only way to start a firmware update would be a command via the SCI A port from a Flash update program. There has to be a way to determine whether the boot is from a power-on reset or a commanded reboot to get into the bootloader to execute the flash kernel for a firmware update. This part has me blocked, because there does not appear to be a register or NVM that a warm-boot flag can be stored in that the boot loader could read to indicate that it needs to load the Flash kernel into RAM and jump to it.

To restart the MCU from the application, there are multiple possibilities:

1. Software reset - this looks like it is the equivalent of a power-on reset, from the reference manual (via the SIMRESET register).
2. Set a Watchdog Timer, and let it expire after a short interval.
3. NMI Watchdog Reset. Using this would not be a good idea in case some other module causes it.
=
In both cases 1 and 2 above the status for the cause can be read from a regoster, but I need a way to specifically tell that a firmware update reboot has occurred.

I am also not sure if the internal bootrom or other boot code completely clears RAM or not. If it does not, I could possibly adjust the stack pointer to leave small RAM block uncleared for a reboot flag.

I am currently looking at the flash_kernel example in the C2000 software (C:\ti\c2000\C2000Ware_5_01_00_00\driverlib\f28p65x\examples\c28x_dual\flash_kernel), but that just runs from RAM. I need a working example of a bootrom that runs in flash and executes the flash_kernel from Flash.

So far, I haven't found anything that is complete for the mcu I am using.

Any help would be greatly appreciated.

Regards,

Joel Estes

  • Hi Joel,

    The internal bootrom will start the bootloader running from Flash, and it will validate the application in Flash and execute it from Flash, or receive it will receive a command to start a firmware update, at which time it will jump to the flash kernel executing from Flash in Flash Bank 0.

    Just to be on the same page -- you have the device boot directly to the bootloader in Bank 0? Then, it decides to jump to the SCI flash kernel or application depending on the SCI commands received. 

    It is my understanding that the it is possible on this mcu that the bootloader can execute from Flash in bank 0 while erasing and reprogramming a different Flash bank.

    Yes, this is correct. The Flash APIs need to run from the bank which is NOT being updated.

    I need a working example of a bootrom that runs in flash and executes the flash_kernel from Flash.

    Unfortunately, we don't have any working examples in C2000Ware that fits these requirements for F28P65x devices. However, you can port the SCI flash kernel to execute from Flash instead of RAM by modifying the linker command file for the flash kernel project.

    Moreover, please check out the LFU with Device Reset Application Note. I know it is for F28004x and is more complicated with two application versions (I will note it is risky to only have one application version) and bank selection logic, but similar principles could be applied for your situation. 

    1. The application executing in Bank 1 receives a DFU SCI RX ISR command and branches to the SCI flash kernel in Bank 0. 
    2. The SCI flash kernel erases Bank 1, loads a hex formatted program (in the appropriate SCI boot format) into flash, and verifies the program.
    3. Then the watchdog is configured for a reset. At the end, the watchdog is enabled for a reset to occur, resetting the device to boot back in Bank 1. 

    You can refer to the F28004x example code for this flow in C2000Ware_X_XX_XX\driverlib\f28004x\exaples\flash\flashapi_ex3_live_firmware_update.c

    Please let me know if I'm misunderstanding your requirements or have any further questions.

    Best,

    Matt

  • I will assume that this issue is resolved and close the thread, as its been several weeks without a response.