Aurix Pflash Erase

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
panda
Level 1
Level 1
5 sign-ins 5 replies posted Welcome!
Hi,
I try to erase Pflash section in my SW.

I try to implement my code according to training data below:
https://www.infineon.com/dgdl/Infineon-AURIX_Flash_Programming_1_KIT_TC297_TFT-Training-v01_00-EN.pd...

And this is my code for erase:
IfxFlash_FlashType FlashType = m_IfxFLASHflashtype(u32sectorAddr);
/* Get the current password of the Safety WatchDog module */
uint16 u16endInitSafetyPassword = IfxScuWdt_getSafetyWatchdogPasswordInline();
IfxScuWdt_clearSafetyEndinitInline(u16endInitSafetyPassword); /* Disable EndInit protection */
/* Erase the sector */
IfxFlash_eraseMultipleSectors(u32sectorAddr,u8numSec);
/* Wait until the sector is erased */
IfxFlash_waitUnbusy(FLASH_MODULE, FlashType);
IfxScuWdt_setSafetyEndinitInline(u16endInitSafetyPassword); /* Enable EndInit protection



When i try this i got a hardware reset.
I do not try to erase where my SW is placed in the Pflash memory. the SW is at different place.
SW is at 0xA000 0000 and erasing must be at 0xA010 0000.

the reset occurs when IfxFlash_eraseMultipleSectors is executed.

Can anyone help me further?

Thx

tc387
0 Likes
1 Solution
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
When you disable the endinit protection then the watchdog goes in timeout mode and will begin to count also when he is switch off. If the endinit protection is not enabled later in time then a watchdog reset will be occur.
When you erase multiple sectors then this can be need more time than the timeout mode allowed.
Enable endinit protection directly after IfxFlash_eraseMultipleSectors before IfxFlash_waitUnbusy. Only function IfxFlash_eraseMultipleSectors must be executed with disabled endinit protection.

View solution in original post

0 Likes
2 Replies
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
When you write or erase to PFLASH, it locks the entire PFLASH bank, not just the sector - see 6.5.2.2.2 Command Sequences on page 396 of AURIXTC3XX_um_part1_v2.0.pdf.

Code for erasing and writing is copied to RAM and executed from there. It is possible to write/erase to a different bank - e.g., execute from PF0 and write to PF1.
0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
When you disable the endinit protection then the watchdog goes in timeout mode and will begin to count also when he is switch off. If the endinit protection is not enabled later in time then a watchdog reset will be occur.
When you erase multiple sectors then this can be need more time than the timeout mode allowed.
Enable endinit protection directly after IfxFlash_eraseMultipleSectors before IfxFlash_waitUnbusy. Only function IfxFlash_eraseMultipleSectors must be executed with disabled endinit protection.
0 Likes