2022-08-04 03:07 AM
Hi,
I need to write some config data to the flash and tried to start from the example FLASH_EraseProgram for NUCLEOWB15. But I got problems already when running the example without any modification. My setup:
Wen I look at the registers, the program counter shows WWDG_IRQHandler, maybe a watchdog problem?
Any help is appreciated!
Regards Volker
Content of the registers:
General Registers General Purpose and FPU Register Group
r0 56
r1 536871108
r2 1476411392
r3 1073807810
r4 536871068
r5 0
r6 0
r7 536883164
r8 0
r9 0
r10 0
r11 0
r12 0
sp 0x20002fb8
lr -7
pc 0x80001ec <WWDG_IRQHandler>
xpsr 16777219
d0 0
d1 0
d2 0
d3 0
d4 0
d5 0
d6 0
d7 0
d8 0
d9 0
d10 0
d11 0
d12 0
d13 0
d14 0
d15 0
fpscr 0
primask 0
basepri 0
faultmask 0
control 0
msp 0x20002fb8
psp 0x0
s0 0
s1 0
s2 0
s3 0
s4 0
s5 0
s6 0
s7 0
s8 0
s9 0
s10 0
s11 0
s12 0
s13 0
s14 0
s15 0
s16 0
s17 0
s18 0
s19 0
s20 0
s21 0
s22 0
s23 0
s24 0
s25 0
s26 0
s27 0
s28 0
s29 0
s30 0
s31 0
2022-08-04 04:53 AM
I tested other examples, just to see if there is a pattern:
- FLASH_WriteProtection same problem
- WWDG_Example works
- WWDG_RefreshUntilUserEvent_Init works
- GPIO_IOToggle works
- EXTI_ToggleLedOnIT_Init works
- BSP_Example works
2022-08-04 06:56 AM
Investigating further I found a difference of FLASH_EraseProgram to WWDG_Example in the NVIC settings. I added "Generate IRQ handler" accordingly and now the program ends in the HardFault_Handler instead of the Default-handler:
2022-08-16 06:09 AM
Hello @VSaro.1
First thanks for posting.
In this case I recommend that you check the user configuration under the Option Bytes for your SOC with CubeProgrammer.
Specifically the IDWGSW it should be Unchecked.
Kind regards,
Semer.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-08-29 08:07 AM
Thanks Semer, it seems to work now.
Kind regards
Volker
2022-08-29 08:46 AM
Hello Semer,
ok, after unchecking IDWGSW it doesn't end in the WWDG_IRQHandler() but...
the program never returns from the call to HAL_FLASHEx_Erase(&EraseInitStruct, &PageError), see line 145 in FLASH_EraseProgram/Src/main.c.
Is there another option maybe?
Kind regards
Volker