About Interrupt while erasing and writting DFLASH and PFLASH

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

About Interrupt while erasing and writting DFLASH and PFLASH

1,022 次查看
赵子成
Contributor IV

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?

0 项奖励
6 回复数

781 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 项奖励

781 次查看
赵子成
Contributor IV

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. 

0 项奖励

781 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 项奖励

781 次查看
赵子成
Contributor IV

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.

0 项奖励

781 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Only this:

FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK;               // launch command
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0); // wait until complete

BR, Daniel

0 项奖励

781 次查看
赵子成
Contributor IV

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.

0 项奖励