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.

F28M35H52C: Flash erase and program APIs for C28x flash block does not work when i execute the program.

Part Number: F28M35H52C
Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I am using code composer studio Version: 6.0.0.00190 and compiler version is TI v6.2.5. All the libraries and includes files have been added to the projects

I have been trying to erase and program Sector E in C28x Flash block with some data (lets say 4  16 bits values to 4 locations).

  • The flash pump is gained
  • Flash APIs is initialized
  • Flash bank is set Active
  • Flash is erased (sector E), FSM ready is checked and FMC data cache is flushed
  • Flash is programmed (sector E), FSM ready is checked, read FSM status and FMC data cache is flushed.
  • All CPU interrupts are disabled during erase and program.
  • EALLOW and EDIS is also looked after.

This Flash related code is written in a function and called from main(). All the system initialization, flash intialization, PLL etc are done properly. All the flash user function and library have been made to run from RAM.

My question is that if run the code, the flash API does not write any value to the sector E and neither any of the Flash API function return errors. But if i call this function another time (same function called twice one after the other in main), then i see value written to the sector E, the second time that function is executed. 

I am unable to find why it does not program the flash with that data the first time?

Any quick help in that will be appreciated.

  • Adnan,

    Appreciate the details that you provided for this debug.

    1) What is the Fapi_getFsmStatus() return value when data did not get programmed?

    2) Is there any difference between the first and second call to the function? like the address or data or?

    3) Did the program command return Fapi_statusSuccess for the first function call?

    4) What is the frequency/wait-state configuration that you are using for C28x?

    Please share code if possible (remove any sensitive info or code).

    Thanks and regards,

    Vamsi

  • Hi Vamsi,

    I compared my project code with the example code in C:\ti\controlSUITE\device_support\f28m35x\v210\F28M35x_examples_Dual\flash_prog\c28

    and was able to fix the problem. I was grabbing flash pump right before erasing and programming the flash location within the same function call. By putting the flash pump gain code in the main before the calling the erase and program function made it to work in the first attempt.
  • Adnan,

    Glad that our example helped you solve the problem.

    I asked for sample code to see if any such issue exists.

    Thanks and regards,

    Vamsi