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.

FAPI do_verify failure on F2837xD CPU1

I have a piece of code which disables interrupts, writes data "0x0048 0xAC88 0xFFFF 0xFFFF" into sector A (0x80000).  When I dump memory @0x80000 and pBuffer both show the same values, but Fapi_doVerify call returns Fapi_Error_fail.  Both Fapi library and the following code is in memory.

Is it due to ecc ?

...............................................................................................................................

u32Index = 0x80000;

oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)u32Index,pBuffer,
4,
0,
0,
Fapi_AutoEccGeneration);

while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);

if(oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for possible errors
Flash_Error(oReturnCheck);
break;
}

// Read FMSTAT register contents to know the status of FSM after
// program command for any debug
oFlashStatus = Fapi_getFsmStatus();


// Verify the values programmed. 

oReturnCheck = Fapi_doVerify((uint32 *)u32Index,
2,
(uint32 *)(pBuffer),
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for possible errors
Flash_Error(oReturnCheck);
break;
}

  • Vaman,

    I tried your code and did not see any issues with Fapi_doVerify().  See below code that I used.  When I used below code, the 32-bit value that got programmed at 0x80000 is 0xAC880048 and 0xFFFFFFFF got programmed at 0x80002.  Did you define your pBuffer like below?

    Thanks and regards,

    Vamsi

     

    uint16 pBuffer[4] = {0x0048, 0xAC88, 0xFFFF, 0xFFFF};

    // Erase Bank 1 Sector 1

    oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,

                                                                               (uint32 *)Bzero_SectorA_start);

    // Wait until FSM is done with erase sector operation

    while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}

    u32Index = 0x80000;

    oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)u32Index,pBuffer,

       4,

       0,

       0,

       Fapi_AutoEccGeneration);

    while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);

    if(oReturnCheck != Fapi_Status_Success)

    {

        Example_Error(oReturnCheck);

    }

    // Read FMSTAT register contents to know the status of FSM after

    // program command for any debug

    oFlashStatus = Fapi_getFsmStatus();

    // Verify the values programmed.

    oReturnCheck = Fapi_doVerify((uint32 *)u32Index,

       2,

       (uint32 *)(pBuffer),

       &oFlashStatusWord);

    if(oReturnCheck != Fapi_Status_Success)

    {

       // Check Flash API documentation for possible errors

        Example_Error(oReturnCheck);

    }

  • Thanks for your reply.

    Yes. I did declare and initialize pBuffer like that. As I said, both pBuffer and 0x80000 show the same content in memory browser.

    Note that before this, I wrote to sector B, sector G and sector H without any problems.

    I copied data from sector B to local buffer and wrote the content to sector A. On CPU2 it worked fine. I am testing with F2837xD_FLASH_link_cpu1.cmd (Stand alone flash). Before calling do_Verify, should I flush ..?
  • Ok. I found the problem. My buffer is at 0xB923. If it is at 0xB924, it works fine. How can I align pBuffer ? I am using gcc.

    Thanks
  • Vaman,

    In this case, since verify is done on 32-bit data, you can align pBuffer on a 32-bit boundary by assigning it to a section aligned on a 32-bit boundary.

    In your code, you can do as below:

    #pragma DATA_SECTION(pBuffer, "data_buffer");

    uint16 pBuffer[4] = {0x0048, 0xAC88, 0xFFFF, 0xFFFF}; 

    In your linker command file, you can map the above section to a 32-bit aligned memory address by using ALIGN() parameter as below:

    data_buffer  : >  RAMx,  PAGE = 1,  ALIGN(2) 

    "ALIGN(2)" aligns the section data_buffer to start on a 32-bit memory boundary.

    Thanks and regards,
    Vamsi

  • Vaman,

    Did you try aligning the buffer on a 32-bit boundary?

    Thanks and regards,
    Vamsi
  • Vaman,

    Were you able to successfully verify the programmed content after aligning the check buffer on 32-bit boundary? I will close this thread once you confirm.

    Thanks and regards,
    Vamsi