Hi, All
When erasing and writting DFLASH and PFLASH, is it necessary to disable all the interrupt and recover the interrupt after finishing erasing and writting DFLASH and PFLASH?
Hi,
It depends on where the interrupt vector table and the interrupt routines are located.
Because if there are located on the same flash block, they cannot be called while there is a program/erase operation in progress on the same block.
Please take a look at 36.5.9.4 Allowed simultaneous flash operations and 36.1.9 Simultaneous operations on PFLASH read partitions, S32K11x RM rev.9.
Regards,
Daniel
Hi Daniel,
I enable an interrupt of 100us per cycle. Then I erase one sector of data flash.
I called an API function called "C40_Ip_MainInterfaceSectorErase" to erase data flash
During erasure, interrupts cannot be responded to.
After erasure, interrupts can be responded to normally.
So, how to achieve the goal to enter interrupts while erasing data flash?
Looking forward to your reply
Hi Daniel
What I want to ask is that If I Enable all interrupts(like the PIT and CAN interrupt and so on),Can I erase or program the PFLASH and DFLASH at the same time?
Or must I disable all the interrupts before erase or program the PFLASH and DFLASH?
Thanks.
Hi,
What S32K1xx derivative do you have? S32K116/118/142/144 have only one PFlash block.
Basically, you can't read/execute code from a PFlash block when there is a flash operation (erasing/programming) on the PFlash block in progress. So, if you have the interrupt table or the ISRs functions in the block or the ISR read some data from the PFlash block, you must disable the interrupts before the PFlash operation. Avoid any simultaneous access to the block. Similarly for DFlash.
Regards,
Daniel
Hi Daniel,
Thanks for your help.
I use S32K144, Pflash size is 512K Bytes.
I still have a doubt, if I Erase and Program the Pflash, must the Erase and Program code in the RAM.
What I means is : Must I put the Erase and Program Pflash codes in RAM and run the erase and program Pflash code from RAM?
Thanks.
Hi,
Only this:
FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK; // launch command
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0); // wait until complete
BR, Daniel
OK, I know, I can see the SDK codes like this :
START_FUNCTION_DEFINITION_RAMSECTION
static status_t FLASH_DRV_CommandSequence(const flash_ssd_config_t * pSSDConfig)
END_FUNCTION_DEFINITION_RAMSECTION
That means it is in the RAM.
Thanks.