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.

TMS320F280049C: Writing in OTP memory to change Boot mode settings in C

Part Number: TMS320F280049C

Hi all,

I followed this thread to always boot from Flash: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/715617/tms320f280049c-writing-in-otp-memory-to-change-boot-mode-settings

 I added this to the linker file:

   OTP_BMODE : origin = 0x07800C, length = 0x000001 /* Add by me */
   OTP_KEY : origin = 0x07800D, length = 0x000001 /* Add by me */
   OTP_Boot : origin = 0x07801C, length = 0x000003 /* Add by me */

and added this at the top of the main.c file:

#pragma DATA_SECTION(OTP_BMODE,"OTP_BMODE");
#pragma DATA_SECTION(OTP_KEY,"OTP_KEY");
#pragma DATA_SECTION(OTP_Boot, "OTP_Boot");
const uint16_t OTP_BMODE = 0x5AFF; <- this is wrong
const uint16_t OTP_KEY = 0xFFFF;   <- this is wrong
const uint16_t OTP_Boot = 0xFF03;

 

After flashing, the OTP has the expected content:

However the Boot Mode can still be changed with the GPIO. If GPIO24 is held down the code won't boot. Did I miss anything?
Thanks

  • Looks like I swapped 2 values...

    The correct main.c content should be:

    #pragma DATA_SECTION(OTP_KEY,"OTP_KEY");
    #pragma DATA_SECTION(OTP_BMODE,"OTP_BMODE");
    #pragma DATA_SECTION(OTP_Boot, "OTP_Boot");
    const uint16_t OTP_KEY = 0x5AFF;
    const uint16_t OTP_BMODE = 0xFFFF;
    const uint16_t OTP_Boot = 0xFF03;