[S32K144] Reset when OTP read is done frequently

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

[S32K144] Reset when OTP read is done frequently

1,421 Views
pekor
Contributor II

Hello community,

I have a problem when with my S32K144 device when want to do quick sequence of reading out OTP section.

I use NXP SDK Flash Driver function ("FLASH_DRV_ReadOnce") for that, which I call 8 times to readout the whole OTP section (8 records with 8 bytes of data). Sometimes when I do this I get reset of the device. And it's hard to tell what is the root-cause of this reset. Debugger goes crazy when I want to do step-by-step debug. Last thing I catch is that I get en error state in in this call:

/*FUNCTION**********************************************************************
 *
 * Function Name : FLASH_DRV_CommandSequence
 * Description : Perform command write sequence on Flash.
 * It is internal function, called by driver APIs only.
 *
 *END**************************************************************************/
START_FUNCTION_DEFINITION_RAMSECTION
static status_t FLASH_DRV_CommandSequence(const flash_ssd_config_t * pSSDConfig)
{
 status_t ret = STATUS_SUCCESS; /* Return code variable */

/* Clear CCIF to launch command */
 FTFx_FSTAT |= FTFx_FSTAT_CCIF_MASK;

while (0U == (FTFx_FSTAT & FTFx_FSTAT_CCIF_MASK))
 {
 /* Wait till CCIF bit is set
 * Serve callback function as often as possible
 */
 if (NULL_CALLBACK != pSSDConfig->CallBack)
 {
 /* Temporarily disable compiler's check for ROM access call from within a ram function.
 * The use of a function pointer type makes this check irrelevant.
 * Nevertheless, it is imperative that the user-provided callback be defined in RAMSECTION */
 DISABLE_CHECK_RAMSECTION_FUNCTION_CALL
 (pSSDConfig->CallBack)();
 ENABLE_CHECK_RAMSECTION_FUNCTION_CALL
 }
 }

/* Check if an error is occurred */
 if ((FTFx_FSTAT & (FTFx_FSTAT_MGSTAT0_MASK | FTFx_FSTAT_FPVIOL_MASK | FTFx_FSTAT_ACCERR_MASK | FTFx_FSTAT_RDCOLERR_MASK)) != 0U)
 {
 ret = STATUS_ERROR; //<< BP here
 }

return ret;
}
END_FUNCTION_DEFINITION_RAMSECTION‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

The place when I can catch something is in "ret = STATUS_ERROR" line.

But I don't know if that is a false positive, because when I look into the FTFxFSTAT it contains no error. When doing step-by-step debugging, I cannot exit this function call, and it goes back to error checking few times and then I got the reset.

Issue can be also reproduced when using only 1 record and do cycle readout.

Does anyone know what could possibly be a problem here?

Or maybe someone know how to trace the issue right?

Environment:

MCU: S32K144_64

IDE: S32DS 2018.R1 with ProcessorExpert

Debugger: J-Link

SDK: RTM 2.0.0

Project build config: FLASH

Kind regards,

Piotr K.

Labels (1)
2 Replies

1,247 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Piotr,

It could be the FTFx_FSTAT_RDCOLERR error.

pastedImage_1.png

Could you please try disabling/masking all interrupts before the function is called?

Thank you,

BR, Daniel

1,247 Views
pekor
Contributor II

Hello Daniel,

Disabling/Enabling interrupts actually fixes the problem.

Thank You for the hint.

Kind regards,

Piotr K.