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".
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.
2.
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
已解决! 转到解答。
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.
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
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'.
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.
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 .
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.