Skip to content

Commit

Permalink
Disable interrupt during FTFC operation
Browse files Browse the repository at this point in the history
  • Loading branch information
sammytranGeo authored and acassis committed Mar 6, 2024
1 parent 89bd6ab commit b4b7710
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/arm/src/s32k1xx/s32k1xx_progmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ static uint32_t execute_ftfc_command(void)
uint8_t regval;
uint32_t retval;

/* AN12003: only one FlexNVM operation can be executed at a time.
* Disable ISR during this time so an ISR doesn't cause a hardfault
* from a simultaneous read.
*/

irqstate_t flags = enter_critical_section();

/* Clear CCIF to launch command */

regval = getreg8(S32K1XX_FTFC_FSTAT);
Expand All @@ -87,6 +94,8 @@ static uint32_t execute_ftfc_command(void)

retval = getreg8(S32K1XX_FTFC_FSTAT);

leave_critical_section(flags);

if (retval & (FTTC_FSTAT_MGSTAT0 | FTTC_FSTAT_FPVIOL |
FTTC_FSTAT_ACCERR | FTTC_FSTAT_RDCOLERR))
{
Expand Down

0 comments on commit b4b7710

Please sign in to comment.