S32DS for ARM 2.2 - Flash erase & program problem

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

S32DS for ARM 2.2 - Flash erase & program problem

Jump to solution
1,487 Views
xu_wenming
Contributor II

Hello,

I use S32K148 with S32DS driver SDK3.0.2 to implement the application erasing and reprogramming.

1. when I use the following functions:

       FLASH_DRV_EraseSector(&flashSSDConfig, 0x10000, 4096);

       FLASH_DRV_Program(&flashSSDConfig, 0x10000, 4096, data_ptr);

       >> It stucks and triggers lockup reset. 

2. I realize that interrupts SHOULD be disabled first:

       INT_SYS_DisableIRQGlobal();

       FLASH_DRV_EraseSector(&flashSSDConfig, 0x10000, 4096);

       FLASH_DRV_Program(&flashSSDConfig, 0x10000, 4096, data_ptr);

       INT_SYS_EnableIRQGlobal();

       >> It works fine and it takes around 30ms to finish.

3. However, it comes up the problem in time critical system.

       We use also Flexcan to communicate with client and heart-beat message should be sent periodically in every 4ms maximum. It's implemented using interrupts (both rx and tx). 

       After disabling all interrupts for 30ms, all functions which use interrupt would be delayed. 

Is there some wrong the way I use the S32DS driver? 

Please give some suggestion if any. 

BRs,

Matthew Xu

1 Solution
1,398 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Matthew,

You could disable the interrupt just before a FTFC command is launched in the FLASH_DRV_CommandSequence() function (CCIF = 1). But the commands can take more than 4ms anyway, please find the execution time of the FTFC commands in the datasheet:

pastedImage_4.png

The interrupts do not have to be disabled, but the flash block (or partition) that is being programmed by the FTFC module, must not be accessed by the application.

pastedImage_7.png

The S32K148 part has 3 PFlash blocks.

pastedImage_6.png

If the interrupts cause this issue, then, either the vector table or the ISR routines (or its resources) are in the same flash block. If it was in SRAM or in any other flash block, you would not need to disable the interrupts.

Regards,

Daniel

View solution in original post

3 Replies
1,399 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Matthew,

You could disable the interrupt just before a FTFC command is launched in the FLASH_DRV_CommandSequence() function (CCIF = 1). But the commands can take more than 4ms anyway, please find the execution time of the FTFC commands in the datasheet:

pastedImage_4.png

The interrupts do not have to be disabled, but the flash block (or partition) that is being programmed by the FTFC module, must not be accessed by the application.

pastedImage_7.png

The S32K148 part has 3 PFlash blocks.

pastedImage_6.png

If the interrupts cause this issue, then, either the vector table or the ISR routines (or its resources) are in the same flash block. If it was in SRAM or in any other flash block, you would not need to disable the interrupts.

Regards,

Daniel

1,398 Views
xu_wenming
Contributor II

Hello Daniel,

Thanks for explanation, I put the application at 0x80000, it works fine now.

I still have some confusions:

1. No matter where I locate the bootloader, bootloader would take the whole block, otherwise any application in same block cannot be reprogrammed via Flexcan with UDS (Vehicle Unified Diagnostic Services) protocol; 

2.  How can I reprogram bootloader itself? S32K148 does not have swap feature, if the donwloading progress is interrupted by any reason, bootloader would be damaged permanently. 

BRs,

Matthew Xu

0 Kudos
1,398 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Matthew,

Could you please create a new thread?

Thank you,

Regards,

Daniel

0 Kudos