S32K FLASH_DRV_CommandSeque issue in "Program Partition command "

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

S32K FLASH_DRV_CommandSeque issue in "Program Partition command "

Jump to solution
1,300 Views
zzkk
Contributor I

Hello,I am using s32k1xx.I have  found a issue about the"FLASH_DRV_CommandSeque"when it launched in different  memory block.

I knew that when used " __attribute__((section (".code_ram")))",it would be launch in RAM.I I wanted to know if I can still use flash erase command or program command if I delete this definition.Then I have found the issue:

1.When the program runs to  eee Initialization function "FLASH_DRV_DEFlashPartition➡FLASH_DRV_CommandSequence",mcu will reset.Reset source is "LOCK UP".I used the "step over".

zzkk_1-1689904631398.png

zzkk_2-1689904738570.png

zzkk_3-1689904970339.png

2.Before mcu reset, I used the "step into" to run "FLASH_DRV_CommandSequence".The program will run normally and also I debugged the same program again,issue 1 that I described earlier will not happen.

3.In issue 1 and 2 process,the FTFC_FSTAT is normally.CCIF is 1 before every memory commands. 

I have read the S32RM manual then I find these reasons:

1.

zzkk_4-1689906565897.png

2.

zzkk_5-1689906577243.png

I don't know if I have found the cause of the issue.

I have  4 questions:

1.In issue 1 when I used the "step over" to run eee Initialization function,Why does the MCU reset?

2.In issue 2 when I used the "step into" to run "FLASH_DRV_CommandSequence",Why can the program run normally?Why I debugged the same program again,issue 1 that I described earlier will not happen?

3.How to understand Reason 1 and Reason 2,are they causing this issue?

4.If I can still use flash erase command or program command if I delete the"__attribute__((section (".code_ram")))"?What are the block requirements for flash erase command or program command if I delete the"__attribute__((section (".code_ram")))"?

if you have any ideas,please contact me or comment in the comment sections,Thanks so much.

Best regards,

ZZKK

 

 

 

 

 

0 Kudos
Reply
1 Solution
1,175 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@zzkk

1.我一直问你是否对器件已经进行过分区操作了,你一直回答我已经分过区了,我强调过已经执行过分区的器件不能再直接执行分区操作。

2.一直和你强调要将FLASH_DRV_CommandSeque操作map到SRAM中避免可能的RWW错误,即使你关闭全局中断,但是这并不意味着你关闭了所有的中断,有一些内核中断不在其中。

 

View solution in original post

0 Kudos
Reply
7 Replies
1,259 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@zzkk

Usually there are two reasons for this kind of problem:
1. If the Flash driver runs on a Flash block with only one RWW partition, it is recommended that you map "FLASH_DRV_CommandSeque" into SRAM, which can avoid RWW (Read While Write) errors.
2. When performing flash operations, interrupts need to be turned off.

0 Kudos
Reply
1,242 Views
zzkk
Contributor I

Hi@Senlent, at first, thank you for your answer.

1. I can still use the flash command(Erase and Program) when I don't map "FLASH_DRV_CommandSeque" into SRAM.

2.I  can't initialize the EEE during mcu initialization,it will stuck in FLASH_DRV_DEFlashPartition ➡FLASH_DRV_CommandSeque.Before I operate the flash,I have turned off the interrupt already.

3.  I used the "step into"in debug,I ran FLASH_DRV_DEFlashPartition ➡ FLASH-DRV_CommandSequence once.After that I  can initialize the EEE during mcu initialization.

Can you explain for "2"and"3"? Thanks so much.

Best Regards,

zzkk

 

 

 

0 Kudos
Reply
1,231 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@zzkk

1. This is not necessary, it is just recommended that you map this part of Flash operations to SRAM to avoid such problems
2. Have you already partitioned your device?

0 Kudos
Reply
1,225 Views
zzkk
Contributor I

Hi@Senlent 

I have partitioned  my device already,address distribution:

0x000-0xC000 is boot

0xC000 beginning is APP

I used the flash command in boot (Erase and Program) to operate APP flash.

But now,I just can't initialize my EEE in boot because of the  'FLASH_DRV_CommandSeque'.

0 Kudos
Reply
1,212 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@zzkk

The partition operation only needs to be performed once. If the device has already been partitioned, the partition operation will fail. The normal execution process is to read the partition information and perform flash operations according to your needs.

0 Kudos
Reply
1,188 Views
zzkk
Contributor I

Hi@Senlent :

Actually,I have partitioned my device before.I just  debug a new program the only difference between it and  the original program is deleted the "__attribute__((section (".code_ram")))".

In both programs,I also have read the partition information when I  prepared for  EEE initialization,just like the screenshot .

zzkk_0-1690261533719.png

Does this issue occur when a new program is debugged? Perhaps my judgment method is incorrect?I think the point of issue is  about "FLASH_DRV_CommandSeque".

I need your explain in detail ,thanks for your help very much.

 

 

 

0 Kudos
Reply
1,176 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@zzkk

1.我一直问你是否对器件已经进行过分区操作了,你一直回答我已经分过区了,我强调过已经执行过分区的器件不能再直接执行分区操作。

2.一直和你强调要将FLASH_DRV_CommandSeque操作map到SRAM中避免可能的RWW错误,即使你关闭全局中断,但是这并不意味着你关闭了所有的中断,有一些内核中断不在其中。

 

0 Kudos
Reply