AnsweredAssumed Answered

FlashArrayIntegrity problem(MPC5744P)

Question asked by xiaobo zheng on May 4, 2016
Latest reply on May 6, 2016 by Lukas Zadrapa

Dear all:

        when i test FlashArrayIntegrityCheck this function on our mpc5744p board, i found this function will crash.   I don't know why this is happen, is parameters problem ? or others?  is there any similar example to show me how to use this function? please?

 

 

static uint32_t FlashArrayIntegrity_Check(PSSD_CONFIG pSSDConfig,
            UINT32 lowEnabledBlocks,
            UINT32 midEnabledBlocks,
            UINT32 highEnabledBlocks,
               N256K_BLOCK_SEL n256KEnabledBlocks,
            UINT8 breakOption,
            UINT8 addrSeq,
            PMISR pMisrValue,
            PCONTEXT_DATA pCtxData)
{
           UINT32 returnCode;
          UINT32 demoResult;

returnCode = pFlashArrayIntegrityCheck(pSSDConfig,
            lowEnabledBlocks,
            midEnabledBlocks,
            highEnabledBlocks,
            n256KEnabledBlocks,
            breakOption,
            addrSeq,
            pMisrValue,
            pCtxData);

    if(C55_OK == returnCode)
    {
           demoResult = WaitOperationFinish(pSSDConfig, C55_MODE_OP_PROGRAM, pCtxData);
     }
    else
    {
        demoResult = DEMO_FAIL;
    }

    return (demoResult);

}

 

 

 

/*

   MISR values calculated by your offline tool.only check 4 blocks.

    MISR_gen   -m 0x04600802 -b MPC5744P_startAddress.txt  -s sky_core.run -as 1 -f256 0xf -o chexk.ext

*/

PMISR exp_MISR[]= {
0x245d1d89,
0x5c141599,
0x91c47111,
0xe5cc1581,
0x1518d140,
0xa1411141,
0x9554a1d9,
0xe10c910c,
0x658195cd,
0x00000000
};

static BOOL Sys_FlashArrayIntegrity_Check()
{
     register UINT32 returnCode; 
      CONTEXT_DATA checkCtxData;
      UINT8 addrSeq;
       PMISR pMisrValue;

UINT32 lowEnabledBlocks;     /* selected blocks in low space */
UINT32 midEnabledBlocks;     /* selected blocks in middle space */
UINT32 highEnabledBlocks;    /* selected blocks in high space */
N256K_BLOCK_SEL n256KBlockSelect; 
/**************************************************************************/
    /* Initialize Flash */
    /**************************************************************************/
    ssdConfig.c55RegBase        = C55_REG_BASE;
    ssdConfig.mainArrayBase     = MAIN_ARRAY_BASE;
    ssdConfig.uTestArrayBase    = UTEST_ARRAY_BASE;
    ssdConfig.mainInterfaceFlag = TRUE; /*Utest interface*/
    ssdConfig.programmableSize  = C55_PROGRAMMABLE_SIZE;
    ssdConfig.BDMEnable         = FALSE;
   checkCtxData.pReqCompletionFn  = pFlashArrayIntegrityCheck;


    /**************************************************************************/
    /* Unlock all blocks in low address space                                 */
    /**************************************************************************/
    returnCode = pSetLock(&ssdConfig, C55_BLOCK_LOW, UNLOCK_LOW_BLOCKS);
    if (C55_OK != returnCode)
    {
        ErrorTrap(returnCode);
    }

    /**************************************************************************/
    /* Unlock all blocks in mid address space                                 */
    /**************************************************************************/
    returnCode = pSetLock(&ssdConfig, C55_BLOCK_MID, UNLOCK_MID_BLOCKS);
    if (C55_OK != returnCode)
    {
        ErrorTrap(returnCode);
    }

    /**************************************************************************/
    /* Unlock all blocks in high address space                                                                           */
    /**************************************************************************/

    returnCode = pSetLock(&ssdConfig, C55_BLOCK_HIGH, UNLOCK_HIGH_BLOCKS);
    if (C55_OK != returnCode)
    {
        ErrorTrap(returnCode);
    }

    /**************************************************************************/
    /*                                            Unlock all blocks in 256K blocks                                           */
    /**************************************************************************/
    returnCode = pSetLock(&ssdConfig, C55_BLOCK_256K_FIRST, UNLOCK_FIRST256_BLOCKS);
    if (C55_OK != returnCode)
    {
        ErrorTrap(returnCode);
    }

    returnCode = pSetLock(&ssdConfig, C55_BLOCK_256K_SECOND, UNLOCK_SECOND256_BLOCKS);
    if (C55_OK != returnCode)
    {
        ErrorTrap(returnCode);
    }

lowEnabledBlocks = 0x0;
midEnabledBlocks = 0x0;
highEnabledBlocks = 0x0;

addrSeq = 1; 
n256KBlockSelect.first256KBlockSelect  = 0xf ;
n256KBlockSelect.second256KBlockSelect = 0x0 ;


returnCode = FlashArrayIntegrity_Check(&ssdConfig,
        lowEnabledBlocks,
        midEnabledBlocks,
        highEnabledBlocks,
        n256KBlockSelect,
        C55_BREAK_ON_DBD_SBC,
        C55_ADDR_SEQ_LINEAR,
        &exp_MISR[0],
        &checkCtxData);
       
    if (returnCode == DEMO_FAIL)
    {
          ErrorTrap(returnCode);
    }    

}

Outcomes