2024-12-02 01:45 PM
Hi Folks,
I'm stuck with an intermittent error on an array value ( array[0]) , which is sometimes overwritten to value "0" instead of the necessary value.
I'm not able to find the source of this problem, is there any way to debug and intercept which instruction is actually overwriting this specific array location?
The array should be written at turn on, and then never modified.
Using standard debug, it seems the writing routine is never called after initialization, but after some time, array[0] is overwritten with "0"
MCU is STM32U595 and code is written on STM32Cube in C
No hardfault appears nor other unexpected behaviour, except for this array[0] value
Best Regards,
Anton
2024-12-02 02:13 PM
Well the debugger via DWT/FPB should be able to trap on specific accesses.
Is it other parts of the code? Can you add some guard zones at either end to monitor?
Can you monitor from the 1 ms / 1 KHz SysTick, and at least pin it down to some specific set of circumstances, or code execution. Can you add other instrumentation to check when it occurs or narrow it down to specific subroutines? Can you check the routine(s) that normally write to it?
Some errant pointer, or unrelated code?
If the arrays only written once, perhaps put it in an area that's protected by the CPU/MPU, so a subsequent write will Bus Fault?