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.

TMS320F28075: Can not execute Flash API writes from DCSM secured RAM

Part Number: TMS320F28075

As part of my design, I am implementing flash emulated EEPROM in the 'f28075.  It works perfectly when the device is unsecured.  I am now trying to lock down the chip in preparation for customer delivery.  I have setup the DSCM with passwords and made all Flash sectors, LSx Ram and Dx Ram secured to the same zone (Zone 1). When I run the program, the Flash write portion of my program does not write anything to flash.

Debugging Observations:

  • "Fapi_issueProgrammingCommand()" is used  in the flash_write() routine.
  • The "Fapi_issueProgrammingCommand() returns a status of "Fapi_Status_Success" when executed, however examination of Flash shows that nothing has been written.
  • Flash reads (using "Fapi_doMarginRead()") seem to work properly.
  • All Flash API functions and any routines that contain Flash API calls are copied to RAM, and those ram functions have been mapped to secure RAM (RAMLSx).
  • If I unlock the chip using Passwork Match Flow, then flash writes operate properly.

Documentation for the DCSM and Flash API indicate that if the flash API routines are executed out of secure RAM, and that RAM is located in the same zone as the secured flash sectors, then the device does not have to be unlocked.

Is it possible to execute flash writes from secure RAM to secure Flash (both located in the same DCSM zone), without having to unlock the device?

  • Hi,

    Is it possible to execute flash writes from secure RAM to secure Flash (both located in the same DCSM zone), without having to unlock the device?

    Yes, this should work.

    Can you check if in code you are grabbing the flash semaphore before starting this operation. Basically changing the value of SEM field in FLSEM register (refer section 2.14.13.1 FLSEM Register (Offset = 0h) [reset = 0h]) to 0x01.

    Regards,

    Vivek Singh

  • Toby,

    One more thing to check:  Make sure that the functions in the Fapi_UserDefinedFunctions.c file are assigned to .TI.ramfunc section.

    Thanks and regards,

    Vamsi

  • Hi Vivek,

    I added the following statements just prior to executing "Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 120);"
    // Grab the flash semaphore
    DcsmCommonRegs.FLSEM.bit.KEY = 0xA5;
    DcsmCommonRegs.FLSEM.bit.SEM = 1;

    I only executed this once (not before every write), since all security is constrained to one Zone (Zone 1).

    This did not solve my problem. The behavior is the same as before.
    Is there anything else that I might try?

    Thanks,
    Toby
  • Hi Toby,

    You need to write the KEY and SEM bit same time, like below.

    DcsmCommonRegs.FLSEM.all = 0xA501;

    Please try this and let us know how it goes.

    Regards,
    Vivek Singh
  • Hi Vamsi,

    All the Fapi functions and library are assigned to a "ramfuncs" section (using #pragma). Do I have to change them all to .TI.ramfuncs? In the linker command file, it appears that ramfuncs section is essentially the same as the .TI.ramfuncs section. I didn't see any other code that was being allocated to .TI.ramfuncs.

    I am using C compiler version: TI v16.12.0.STS

    Thanks
    Toby
  • Hi Vivek,

    Your last suggestion solved my problem!

    Thanks!
    Toby
  • Toby,

    Yes, if the compiler version >= 15.9.x, you need to use the name .TI.ramfunc instead of ramfuncs.  

    If you use the latest examples/cmd files, you will notice below defines using the compiler version to allocate to the correct section:

    #ifdef __TI_COMPILER_VERSION__
        #if __TI_COMPILER_VERSION__ >= 15009000
            GROUP
            {
                .TI.ramfunc
                { -l F021_API_F2837xS_FPU32.lib}
             
            } LOAD = FLASHD,
              RUN  = RAMLS03, 
              LOAD_START(_RamfuncsLoadStart),
              LOAD_SIZE(_RamfuncsLoadSize),
              LOAD_END(_RamfuncsLoadEnd),
              RUN_START(_RamfuncsRunStart),
              RUN_SIZE(_RamfuncsRunSize),
              RUN_END(_RamfuncsRunEnd),
              PAGE = 0    
        #else
            GROUP
            {
                ramfuncs
                { -l F021_API_F2837xS_FPU32.lib}
             
            } LOAD = FLASHD,
              RUN  = RAMLS03, 
              LOAD_START(_RamfuncsLoadStart),
              LOAD_SIZE(_RamfuncsLoadSize),
              LOAD_END(_RamfuncsLoadEnd),
              RUN_START(_RamfuncsRunStart),
              RUN_SIZE(_RamfuncsRunSize),
              RUN_END(_RamfuncsRunEnd),
              PAGE = 0    
        #endif
    #endif

    Thanks and regards,

    Vamsi