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.

TMS320F280049: When using the flash API to write to secure flash, is the CSM unlock needed? And help debugging

Part Number: TMS320F280049

We are writing a bootloader for a TMSF280049. The application code is sent to the device using bank 1 as a scratch space, then written to flash bank 0. This is working as intended.

I have now written some OTP settings to the device. I have all memory and flash bank 0 sectors allocated to zone 1 (GRABRAM = 0x55555555, GRABSECT = 0x55555555), and the CSM password written. I have not yet written to Z1OTP_PSWDLOCK. I can unlock the device to reupload my bootloader, and the bootloader is still running. I have not written to zone 2 OTP, and bank 1 flash is unsecured.

When I use my bootloader to upload application code, it's failing around the time we read the application code from bank 1, and write it into bank 0 using the ROM Flash API.

I'm struggling to debug this because I now can't debug the code via JTAG. It seems Fapi_issueProgrammingCommand is not returning any errors, but our following CRC check fails.

The code should be running from secure memory. Do we need to use CsmUnlock() before writing to secure flash belonging to the same CSM zone?

Do we also need bank 1 flash to belong to zone 1?

In CCS, when using JTAG debug, is it possible to unlock the device with our CSM password so we can debug freely?

Any other ideas to help debug would be appreciated.

Thanks

  • Hi,

    The code should be running from secure memory. Do we need to use CsmUnlock() before writing to secure flash belonging to the same CSM zone?

    Are you updating UER OTP area as well ? If yes, then you need to unlock the zone. If not then as long as flash API is running from secure RAM, zone unlock is not needed. If you are using flash API in ROM then you need to unlock the zone before programming the secure flash sectors.

    Do we also need bank 1 flash to belong to zone 1?

    That is not needed because read to bank1 which unsecure should be ok.

    In CCS, when using JTAG debug, is it possible to unlock the device with our CSM password so we can debug freely?

    Yes, you can change the BOOTMODE to WaitBOOT and connect to CCS and then open  flash plugin GUI and unlock the zone by entering correct password value.

    Regards,

    Vivek Singh

  • Hi, thank you for the fast response.

    What do you mean by UER OTP sorry? I've just configured the "User-configurable DCSM OTP Bank 0" (at 0x78000).

    I am using the ROM flash API (F021_ROM_API_F28004x_FPU32.lib). Is it possible to copy this code into RAM before running so that it will be running from secure memory and I won't need to unlock my device? Or will I need to switch to the non-ROM API (F021_API_F28004x_FPU32.lib) and modify my linker script to copy this into RAM?

    I can't find any information on how to access the flash plugin GUI. Is there a doc somewhere I could take a look at? I've taken a look at the Flash API Reference Guide mentioned here: https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/571106 , but I'm not sure how to get to the plugin GUI from Code Composer Studio.

    Thanks,

    Tim

  • I should say, this is Code Composer Studio 9.3.

    This article ( https://software-dl.ti.com/C2000/docs/software_guide/c2000ware/flash.html ) says to use "CCS Debug view -> Tools -> On-chip Flash". However the "On-chip Flash" option is not available to me.

  • Sorry for the chain of replies, just to say I found the Flash Plugin GUI. If you go to:

    Run > Debug Configurations > Target > Flash Settings

    I could enter my password and launch a debug session. Once that was running, I could see the "On-chip flash" view.

  • Hi Tim,

    I am using the ROM flash API (F021_ROM_API_F28004x_FPU32.lib). Is it possible to copy this code into RAM before running so that it will be running from secure memory and I won't need to unlock my device? Or will I need to switch to the non-ROM API (F021_API_F28004x_FPU32.lib) and modify my linker script to copy this into RAM?

    You can not copy API from ROM. You need to switch to non-ROM API and place this in secure Flash sector and then copy the same to secure RAM and do the required operation. Please refer this appnote for more detail. This appnote  is for different C2000 device device but concept is same.

    Regards,

    Vivek Singh