AnsweredAssumed Answered

Found a bug in NV_WriteHWParameters?

Question asked by Roger Chaplin on Feb 1, 2017
Latest reply on Feb 2, 2017 by Carlos Neri

I'm using the MKW41Z Connectivity Software v1.0.2 and I'm seeing something in Flash_Adapter.c that doesn't make sense. In the NV_WriteHWParameters() function it's computing and storing the CRC in the pHwParams variable and then it's setting the identificationWord element, which causes the calculated CRC to (probably) no longer be valid. Is this a bug, or am I missing something? Here's the code (observe the order of operations on lines 3 and 4):

    if(!FLib_MemCmp(pHwParams, (void*)FREESCALE_PROD_DATA_BASE_ADDR, sizeof(hardwareParameters_t)))
        pHwParams->hardwareParamsCrc = NV_ComputeCrcOverHWParameters(pHwParams);
        FLib_MemCpy(pHwParams->identificationWord, (void*)mProdDataIdentifier, sizeof(mProdDataIdentifier));

        if( 0 == status )
            status = NV_FlashProgramUnaligned((uint32_t)FREESCALE_PROD_DATA_BASE_ADDR,