How does I use the C40_Ip_ArrayIntegrityCheck()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How does I use the C40_Ip_ArrayIntegrityCheck()

687 Views
liyongfeng
Contributor II

I use S32K344. Need to implement  SM1.FLASH.AI_SELFCHECK. I think we should use the C40_Ip_ArrayIntegrityCheck function.But  I don't understand how this function is used. Please NXP to provide the associated DEMO.

0 Kudos
Reply
2 Replies

557 Views
liyongfeng
Contributor II

Thank your reply!
ArrayIntegrityCheck Is it a check used for the user code Integrity? or only for hardware check(e.g. sense amplifiers, column muxes, address decoder, voltage/timing references)?
This is the function description in S32K344 macl fls. Please tell me the meaning of the function and how to use it.
/**
 * @brief    Check the array integrity of the flash memory
 *
 * @details  This function will check the array integrity of the flash via
 *           main interface. The user specified address sequence is used for array integrity
 *           reads and the operation is done on the specified blocks. The MISR values calculated
 *           by the hardware is compared to the values passed by the user, if they are not
 *           the same, then an error code is returned.
 *           User should call C40_Ip_CheckUserTestStatus to check the on-going status of this function.
 *           And once finish, it will do comparison between MISR values provided by user which
 *           is currently stored in 'pMisrExpectedValues' and MISR values generated by hardware
 *           and return an appropriate code according to this compared result.
 *
 * @Param[in]       SelectBlock     Select the block base address for checking.
 * @Param[in]       AddressSequence Determine the address sequence to be used during array integrity checks.
 * @Param[in]       BreakPoints     Specify an option to allow stopping the operation on errors.
 * @Param[in]       MisrSeedValues  Value to be written in the MISR registers prior to the check
 * @Param[in]       DomainIdValue   ID for the core that requests program sequence.
 *
 * @return          C40_Ip_StatusTypes
 * @retval          STATUS_C40_IP_SUCCESS            The operation is successful.
 * @retval          STATUS_C40_IP_BUSY               New operation cannot be performed while previous high voltage operation in progress.
 * @retval          STATUS_C40_IP_ERROR_INPUT_PARAM  Input parameters are invalid.
 * @retval          STATUS_C40_IP_ERROR              It's impossible to enable an operation
 * @retval          STATUS_C40_IP_ERROR_TIMEOUT      Errors Timeout because wait for the Done bit long time
 *
 * @pre             The module has to be initialized
 *
 */
C40_Ip_StatusType C40_Ip_ArrayIntegrityCheck(uint32 SelectBlock,
                                             C40_Ip_ArrayIntegritySequenceType AddressSequence,
                                             C40_Ip_FlashBreakPointsType BreakPoints,
                                             const C40_Ip_MisrType *MisrSeedValues,
                                             uint8 DomainIdValue
                                            );
 //================================================================
/**
 * @brief    Check the operation in user test mode
 *
 * @details  This function will check the status array integrity check
 *           in user test mode.
 *
 * @Param[in]      MisrExpectedValues The MISR values calculated by the user to do comparison with MISR values generated by hardware.
 * @Param[out]     TestResult The value return the state of flash.
 *
 * @return         C40_Ip_StatusType
 * @retval         STATUS_C40_IP_SUCCESS            The operation is successful
 * @retval         STATUS_C40_IP_ERROR              Operation failure status
 * @retval         STATUS_C40_IP_BUSY               In progress status
 * @retval         STATUS_C40_IP_ERROR_INPUT_PARAM  input parameters is invalid
 *
 * @pre            The module has to be initialized
 *
 */
C40_Ip_StatusType C40_Ip_CheckUserTestStatus(const C40_Ip_MisrType *MisrExpectedValues,
                                             C40_Ip_UtestStateType *TestResult
                                            );

0 Kudos
Reply

621 Views
ramprakash08
Contributor IV

The C40_Ip_ArrayIntegrityCheck() function is used to perform an array integrity check on the flash memory. This function is part of the flash driver and is used to verify the integrity of the flash memory array. The function performs a read of every address in the flash memory and compares it with the expected value. If the read value does not match the expected value, the function returns an error.

 

Here is a basic usage of the C40_Ip_ArrayIntegrityCheck() function:

 

 #include 'flash_driver.h'
void main(void) { status_t status; flash_drv_config_t flashConfig;
/* Initialize the flash driver */ status = FLASH_DRV_Init(&flashConfig);
if (status == STATUS_SUCCESS) { /* Perform the array integrity check */ status = C40_Ip_ArrayIntegrityCheck(&flashConfig, FLASH_ARRAY_INTEGRITY_CHECK_MODE);
if (status == STATUS_SUCCESS) { /* The array integrity check passed */ } else { /* The array integrity check failed */ } } }

 

This code initializes the flash driver, then calls the C40_Ip_ArrayIntegrityCheck() function to perform the array integrity check. If the function returns STATUS_SUCCESS, the array integrity check passed. Otherwise, the check failed.

 

For more information about the flash driver and the C40_Ip_ArrayIntegrityCheck() function, you can refer to the flash driver API documentation available on the NXP website. You can also refer to the application note AN2504, which provides an easy-to-use C-language API for using flash programming routines that are stored in ROM in the MCUs. The API can be used to program, erase, and verify flash memory as well as to communicate serially.

0 Kudos
Reply