2017-09-18 08:48 AM
STM32F765VI on custom board.
Atollic TrueStudio
SEGGER JLink SWD
I am unable to erase a sector of flash in my custom board using an STM32F765VI chip. I am using the HAL function HAL_FLASHEx_Erase(&EraseInitStruct, &SECTORError). I can step through the program and watch the registers get set properly:
LOCK=0
SER=1
SNB=7
PSIZE=2
I can watch the STRT bit get set, followed by the BSY bit being set. But PG does not get set and the sector is not erased. I see no error flags being set.
Can anyone offer some guidance into what may be happening?
Thanks,
MikeH
2017-09-18 09:42 AM
>>But PG does not get set and the sector is not erased. I see no error flags being set.
Excuse my ignorance with the F7, but why would PG get set during an Erase?
Make sure you're looking at the right memory, the addresses can change based on mapping/banking options.
2017-09-18 12:41 PM
Excuse my ignorance with the F7,
but why would PG get set during an Erase?
Hmm... not your ignorance, but mine.
Make sure you're looking at the right memory, the addresses can change based on mapping/banking options.
I am sure that I am looking at the correct memory space. I can see my op code in the lower sectors. I can also see my config variables stored in the sector I am attempting to erase.
I did actually see the sector get erased once. But I cannot replicate the erasure. I have tried erasing several different sectors to no avail. I have also tried different prarllelism.
2017-10-27 09:25 PM
I am having the same issue. PNB & PER are set correctly, and there is no error. Flash memory remains unaffected..
UPDATE:
It appears that while debugging (jlink), I cannot erase any part of MCU flash. If I remove the JTAG and let the same program execute, the print messages now show erased flash.
Why is this?? Does the STM32 have some sort of flash lockout while debugging?
Note.. it is not cache related, all cache/prefetch, etc is disabled
2017-11-02 05:14 AM
,
,
Curt,
Although I am still working on a solution, I believe that there is some issue with the JLink and the STM32F7xx. The folks at Segger provided a firmware update (V6.20b) that did not fix the problem. The JLink was also not able to accommodate dual-bank mode. But they have now provided a Wiki and a firmware update that is supposed to have fixed the problem (
https://wiki.segger.com/STM32F7 ♯ Flash_Dual_Bank_Mode
). I have not yet had a chance to try it. Let me know if you do.2017-11-02 08:42 AM
I forgot to mention that my setup is STM32L431RC (single flash bank).
Also, the issue isn't that the Jlink flash/programmer does not work (which the above article addresses), it's that erasing from the -code- does not work while debugging. Hopefully I worded that distinction correctly.