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.

Flash API Write

Hello,

i'm working with the TMX320 F28377DZWTT device and have some problems with writing to the Flash.

I executed the following example code and viewed the memory with the memory browser in the Code Composer Studio.
The code contains 3 Flash api write calls, all writing 1 word, but the second call doesn't write the desired word to flash. The other 2 calls are OK.

Are there some restrictions i forgot about?

The return values are always Fapi_Status_Success.

    
    //Flash sector H erased before,

    EALLOW;

    //start of sector H
    uint16_t* pu16StartAddress = (uint16_t*)0xA0000;
    uint16_t pu16DataBuffer = 0x0FFF;
    uint16_t ui16WordsToWrite = 1;

    //working, data@0xA0000 changes to 0x0FFF
	oReturnCheck = Fapi_issueProgrammingCommand((uint32_t*)pu16StartAddress,
												&pu16DataBuffer,
												ui16WordsToWrite,
												0,
												0,
												Fapi_AutoEccGeneration);
	while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);


    pu16StartAddress = pu16StartAddress+1;	//0xA0001
    pu16DataBuffer = 0x3FFF;

    //not working, data @0xA0001 remains 0xFFFF
	oReturnCheck = Fapi_issueProgrammingCommand((uint32_t*)pu16StartAddress,
												&pu16DataBuffer,
												ui16WordsToWrite,
												0,
												0,
												Fapi_AutoEccGeneration);
	while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);


	pu16DataBuffer = 0x0FFF;	
       //working, data@0xA0001 changes to 0x0FFF
	oReturnCheck = Fapi_issueProgrammingCommand((uint32_t*)pu16StartAddress,
												&pu16DataBuffer,
												ui16WordsToWrite,
												0,
												0,
												Fapi_AutoEccGeneration);
	while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);




  • Kristian,

    I noticed that you are using Fapi_AutoEccGeneration mode for programming. This mode will calculate ECC for the 64-bits of data that you provide to the program function and ECC gets programmed along with Flash/OTP data. Any data that is not provided for a given 64-bit aligned memory will be assumed all 1s to calculate the ECC. Hence, make sure to program 64-bits (aligned on a 64-bit memory) at a time when using Fapi_AutoEccGeneration mode.

    If you cannot program all the 64-bits at a time, you can consider programming the data only at first (Fapi_DataOnly) and then program ECC using AutoEccGeneration when all the 64-bits of data is available. To avoid ECC errors, please note that you have to disable ECC logic when you read the Flash when ECC is not programmed.

    Thanks and regards,
    Vamsi
  • Kristian,

    Are you able to program fine now using API?

    Thanks and regards,

    Vamsi

  • Kristian,

    Looks like you are able to program fine now. I am closing this thread.

    Thanks and regards,
    Vamsi