Flash Init Problem

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

Flash Init Problem

Jump to solution
2,796 Views
EE_CW
Contributor III

Hello together

I have a project where I use the internal EEPROM functionality of the S32K148. I adjusted the example code from NXP to write an driver which uses the SDK. For several versions of our Software it worked correctly without any problems.
But now I'm facing the problem that the software gets stucked in the Flash Init routine. But this problem pops up only during flashing a brand new MCU, which was never flashed before.

If I'm flashing an older version of our software, it works without problems (even if the driver of the flash/EEPROM has no changes between these two versions).
I attached the Init routine of my driver. The software stucks as follows:
...
flashinit()
      |__>  FLASH_DRV_DEFlashPartition()
                     |__> FLASH_DRV_CommandSequence()
                                  |__> Programm stops and restart from beginning.

What could be the problem here?

Thanks and regards

Mario

Labels (1)
0 Kudos
1 Solution
2,786 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Mario,

If this init routine has not been changed, the issue must be elsewhere.

If it crashes during this function FLASH_DRV_CommandSequence(), I think there could be two reasons.

1. The function is not in SRAM - please check the .map file of the new SW.

2. The MCU accesses the Flash memory during the partitioning (interrupts, DMA) - can you disable interrupts before the partitioning starts?

I have noticed you install FTFC interrupt routine there. But do you use it in the application?

 

Thanks,

BR, Daniel

View solution in original post

0 Kudos
4 Replies
2,787 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Mario,

If this init routine has not been changed, the issue must be elsewhere.

If it crashes during this function FLASH_DRV_CommandSequence(), I think there could be two reasons.

1. The function is not in SRAM - please check the .map file of the new SW.

2. The MCU accesses the Flash memory during the partitioning (interrupts, DMA) - can you disable interrupts before the partitioning starts?

I have noticed you install FTFC interrupt routine there. But do you use it in the application?

 

Thanks,

BR, Daniel

0 Kudos
1,168 Views
TM_207
Contributor I

hello:

I have encountered the same problem。

1)"FLASH-DRV_CommandSequence"was not placed in SRAM。When I run the "FLASH-DRV-DEFlashPartition" function,Generated 'b Default ISR'. The address of the 'FLASH-DRV_CommandSequence' function is 0x000000f54.

2)"FLASH-DRV_CommandSequence" was  placed in SRAM。When I run the "FLASH-DRV-DEFlashPartition" function.D-Flash Partition successful."FLASH-DRV_ The CommandSequence "function address was not found in the map file

My question is why we need to use FLASH-DRV_ The CommandSequence function is placed in RAM to avoid generating abnormal interrupts

 

0 Kudos
2,778 Views
EE_CW
Contributor III

Hi Daniel

Thanks for your answer.

In the .map file I Couldn't find the FLASH_DRV_CommandSequence. I'm not sure if it should be listed in there in this case?
But your second hint about the interrupts was helpful.

I found something in another part of the software, that caused some interrupts. These were interrupting the partitioning and caused the reset. Now I init the flash as early as possible, before the other part is initialized and starts to cause interrupts.

With this change, I tested it successfully.

Regards
Mario

0 Kudos
2,770 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Mario,

To be sure, you can mask (PRIMASK) all the interrupts before the partitioning starts.

There would be no problem if the interrupt vector table, the interrupt routines and all the resources that the routines use were in SRAM.

 

Regards,

Daniel

0 Kudos