Hi NXP community,
ADC0/ADC1 Interrupts Stop After Runtime Flash Erase/Program Operation on S32K144
As a continuation of my previous question, I need some clarification on how to properly recover from a PDB ADC pre-trigger sequence error on the S32K144.
I tried the following three methods, but only one of them worked correctly.
Method 1 (working):
- Stop PDB0 and PDB1 before performing the flash erase/program operation.
- After the flash operation is complete, restart both PDBs and re-enable the corresponding ISRs.
With this approach, no PDB sequence error occurs.
Method 2:
After the flash erase/program operation was completed, I stopped and restarted PDB0 and PDB1. However, a PDB pre-trigger sequence error occurred. I then attempted to recover by stopping and restarting the PDB modules again, but the sequence error persisted.
Method 3:
Method 3 (Not Working):
I did not stop or restart PDB0 and PDB1 during the flash erase/program operation. Instead, after the operation completed, one pending PDB ISR and ADC ISR were triggered.
Inside the PDB ISR, I attempted to clear the sequence error flag using:
PDB0->CH[0].S &= (uint32_t)(~PDB_S_ERR_MASK);
The corresponding ADC ISR was then executed, and reading the ADC result register cleared the COCO flag. I expected this to prevent further pre-trigger sequence errors, but the issue still persisted and this method did not work.
My question is: once a PDB pre-trigger sequence error has been triggered, is it possible to recover the PDB/ADC operation and resume normal triggering without resetting the system? Or does the PDB need to be stopped and restarted beforehand to avoid entering an unrecoverable state?