S32K311 The FLASH failed to be erased AND a HardFault_Handler occurred

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K311 The FLASH failed to be erased AND a HardFault_Handler occurred

ソリューションへジャンプ
2,515件の閲覧回数
EvaKi
Contributor I

Hi NXP.

I use S32K311, RTD 3 to erase flash by using C40.

When I do some erase operation, the flash failed to be erased and triggered a hardfault

EvaKi_0-1724979161082.png

 

I added some debug messages in the C40_Ip_MainInterfaceSectorErase like the below:

We can see that when: 

/* start internal erase/program sequence */
C40_Ip_pFlashBaseAddress->MCR |= FLASH_MCR_EHV_MASK; is executed, 

Hardfault is triggered directly.

Sometimes, I step through debugging, step by step execution, but will erase successfully, will not trigger the hardfault error,

Is there a correct way to erase FLASH?

EvaKi_1-1724979192706.png

EvaKi_2-1724979244040.png

EvaKi_3-1724979313091.png

 

0 件の賞賛
返信
1 解決策
2,319件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

It is apparetnly RWW issue. You must execute the code from different block or from internal SRAM as it is the same partition

davidtosenovjan_1-1725965798253.png

 

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
12 返答(返信)
690件の閲覧回数
dujunqiu
Contributor I

hello,  must use 2 block?

0 件の賞賛
返信
2,281件の閲覧回数
EvaKi
Contributor I
0 件の賞賛
返信
2,484件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Do you have disabled cache?

0 件の賞賛
返信
2,441件の閲覧回数
EvaKi
Contributor I

Hi @davidtosenovjan 

There are different caches that I had disabled.

This will still trigger Hardfault

EvaKi_3-1725239399560.png

 

 

1. #define C40_IP_SYNCRONIZE_CACHE (STD_OFF)

EvaKi_0-1725239151652.png

2. #define CACHE_IP_IS_AVAILABLE                        STD_OFF

EvaKi_1-1725239235153.pngEvaKi_2-1725239343798.png

 

0 件の賞賛
返信
2,408件の閲覧回数
EvaKi
Contributor I

I have done double verification, the area to be erased is indeed unlocked, so there should be no area to be erased is protected or the unlock fails, resulting in Hardfault error when erasing

0 件の賞賛
返信
2,492件の閲覧回数
EvaKi
Contributor I

If I set the PFLASH's .ld address to be in Block 0(512KB), such as use 200KB.

Then erase the remaining addresses, triggering an HardFault.

at the same time, If I erase the Block 1, everything is ok.

How to solve this condition?

The application scenario is that the Bootloader needs to erase the Flash address of the App

 

 

EvaKi_0-1724995839787.png

 

 

0 件の賞賛
返信
2,371件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Don't you execute this code from the same block you are trying to erase?

0 件の賞賛
返信
2,368件の閲覧回数
EvaKi
Contributor I

Hi @davidtosenovjan 

The application scenario is that the boot program erases the app part, so the boot code and the app code will be in Block0, but in the same Block, erasing the App in the Boot will trigger hardfault

See this pic:

EvaKi_0-1725608585305.png

 

0 件の賞賛
返信
2,320件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

It is apparetnly RWW issue. You must execute the code from different block or from internal SRAM as it is the same partition

davidtosenovjan_1-1725965798253.png

 

 

 

0 件の賞賛
返信
689件の閲覧回数
dujunqiu
Contributor I
hello,which doc is this? i want to learn more
0 件の賞賛
返信
2,290件の閲覧回数
EvaKi
Contributor I

Hi @davidtosenovjan 

Thanks for your support.

0 件の賞賛
返信
2,511件の閲覧回数
EvaKi
Contributor I

Erased area is PFLASH

0 件の賞賛
返信