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.

TMS320F28379D: The program failed to run after power-on due to flash memory operations during power-off

Part Number: TMS320F28379D
Other Parts Discussed in Thread: UNIFLASH

Tool/software:

When working with TMS320F28379DZWTS microcontroller, I encountered an issue when the board suddenly loses power. After repowering, the microcontroller does not run the program normally (indicated by unexpected EtherCAT disconnection). I suspect the DSP Flash data may be somehow changed from its origional content. So using TI UniFlash tool, I read out the FLASH data, and compared it with the data read from another normal board. The result is they are identical! Then I reloaded the original ".out" program into the faulty board with UniFlash, the microcontroller works normally again. My program includes a spectial function with "init, read and write" operations on the FLASH memory using the FAPI interface, this function is activated whenever it detects a power-off (i.e. an input voltage decrease edge). So I suspect the issue above is related with this Flash operation function. After commenting out the FLASH operation code, the issue no longer occurs. So you see my guess is right.Below is my FLASH operation code, including initialization, erasing, and writing data:
uint8 Flash_Init()
{
Fapi_StatusType oReturnCheck;
// Gain pump semaphore
SeizeFlashPump();
EALLOW;
Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;
EDIS;
EALLOW;
oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200); // for now keeping it out
if(oReturnCheck != Fapi_Status_Success)
{
return 1;
}
// Fapi_setActiveFlashBank function sets the Flash bank and FMC for further
// Flash operations to be performed on the bank
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
if(oReturnCheck != Fapi_Status_Success)
{
return 2;
}
EDIS;
return Fapi_Status_Success;
}
Uint16 Flash_Erase(Uint32 section_base_addr)
{
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusWordType oFlashStatusWord;
EALLOW;
// Erase Sector selected
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32 *)section_base_addr);
// Wait until FSM is done with erase sector operation
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady) {}
// Verify that Sector is erased.
oReturnCheck = Fapi_doBlankCheck((uint32 *)section_base_addr, 0x1000, &oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
return 3;
}
EDIS;
return Fapi_Status_Success;
}
Uint16 Flash_Write(Uint32 section_base_addr, Uint16 *pBuff)
{
Fapi_StatusType oReturnCheck = Fapi_Status_Success;
EALLOW;
oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)write_addr, pBuf, len, 0, 0, Fapi_AutoEccGeneration);
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
if(oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for possible errors
return 4;
}
DELAY_US(10L);
EDIS;
return Fapi_Status_Success;
}
  • Hi,

    I will be able to review this thread by early next week.

    Regards,

    Rajeshwary

  • Thank you. I look forward to your prompt reply.

  • Hi, 

    Can you please add below code snippet before you call the DELAY_US(10L); function and see if you see any errors? 

            //
            // Read FMSTAT register contents to know the status of FSM after
            // program command for any debug
            //
            oFlashStatus = Fapi_getFsmStatus();
    
            //
            // Verify the values programmed.  The Program step itself does a verify
            // as it goes.  This verify is a 2nd verification that can be done.
            //
            oReturnCheck = Fapi_doVerify((uint32 *)u32Index,
                                         4, Buffer32+(i/2),
                                         &oFlashStatusWord);
    
            if(oReturnCheck != Fapi_Status_Success)
            {
                //
                // Check Flash API documentation for possible errors
                //
                Example_Error(oReturnCheck);
            }

    Regards,

    Rajeshwary

  • I'm sorry, but I can't verify the method you suggested because my current issue is related to operations on the FLASH during power-off. I can't see the results returned, and the program also fails to start after power-on.
    I have some new findings now. It seems that the problem occurs during the FLASH erase operation. If I keep the FLASH initialization and erase operations but disable the FLASH write operation, the issue can be reproduced. However, if I keep the FLASH initialization but disable both the erase and write operations, no problem is observed.
    Is it possible that erasing the FLASH during power-off could cause the program to fail? I haven't found any anomalies in the FLASH data when reading it. The system can start normally after reprogramming. I really want to understand the reasons behind these issues and find a solution.
  • Hi,

    Could you ensure that when you go to power down  and start flash erase operation, your voltage levels are within the range specified in datasheet?

    If inadequate voltage may cause device in unstable state. 

    Regards,

    Rajeshwary

  • If the power supply drops below the operating voltage during the flash operation, at which stage will the problem occur, and what kind of issues might arise?
    I have discovered a new phenomenon here: the flash operation executes normally before power-off. When I commented out the code for reading the flash data after power-on, the issue did not reoccur. Below is my code for reading the flash data:
    #pragma CODE_SECTION(ReadFlashOffsetData,"ramfuncs");
    Uint32 ReadFlashOffsetData(void)
    {
        Uint32 res;
        Uint16 pData_H,pData_L;
        pData_L = *(Uint16 *)(0x0BE000);
        pData_H = *(Uint16 *)(0x0BE001);
        res = ((Uint32)pData_H << 16) | (Uint32)pData_L;
        return res;
    }
  • Hello

    I have come to the following conclusion: During the operation of a Flash memory, if the power is cut off too quickly, the read operation of the Flash will freeze after power is restored. Could you explain why this happens and what the underlying principles are?

    Regards

  • Hi,

    When you are power down during flash operation, flash is getting corrupted. This might be causing ECC errors when you try to read the flash.

    Regards,

    Rajeshwary

  • Hello, I have verified that after power-on, disabling ECC before reading the FLASH and then enabling ECC after reading the FLASH did not reproduce the issue. Can you give me some suggestions to solve the problem?

    Regards

  • Hi,

    If ECC errors are triggered then this means that you flash is getting corrupted. You have to erase and program it or provide a sufficient time and voltage level during power down mode to complete flash operations

    Regards,

    Rajeshwary