2019-06-20 08:46 AM
Hello,
I have one custom board using STM32H750 MCU. Everything was working perfectly until while doing some testing my code is not launch anymore. This is the second board that was working and stop working for "no" reason. On the first board, after analyzing, I decide to change the MCU, and that solve the problem. But here is the second time I get, so I really need to find the root cause.
my code is running on the external flash, and I am stuck in the startup file during the variable initialization. I run it step by step, expected to find a bad address somewhere, but I reach the end of the init without trouble. But as soon as I do a RUN (still in debug) it does to hardfault.
I try to slow down my clocks (systick and QSPI), but no improvement. I also try to change the RAM where all the variable are store during init, but same thing. Looks like something is really dead.
I will go to production in a few weeks now, and I am really afraid that this will happen on all my product sooner or later...
So any idea is welcome...
Some information that might be usefull.
The startupfile, is the ST one. no modification at all. I have FreeRTOS/TouchGFX as thirdparty library, so quite a lot of initializing. I run at 1.8V.
MemManage, BusFault etc are existing interrupt with while(1) inside. But this is really Hardfault which is triggered.
2019-06-26 06:24 AM
> MemManage, BusFault etc are existing interrupt with while(1) inside. But this is really Hardfault which is triggered.
Do you have them enabled in SCB->SHCSR?
Observe the fault registers, and the stack->disasm when the fault occurs.
Maybe related to this thread https://community.st.com/s/question/0D50X0000AvfBVKSQ2/random-hardfault-bug-with-stm32f730 ?
JW
2019-06-26 06:29 AM
Do you switch speed without observing additional wait states?
2019-06-26 07:10 AM
Stack alignment.
Pushing FPU registers without the FPU being enabled.
Initializing External memories you haven't configured or set up yet.
Touching internal SRAMs who's clocks you haven't enabled.
Using above SRAM for stack.
2019-06-26 07:17 AM
2019-06-26 08:02 AM
@Community member : You're right, it was not enabled. I add the "" SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; " in my bootloader before jumping to the main app (XIP using QSPI).
But still, it seems to be a hardfault. Any chance my instrution here is wrong ?
@Uwe Bonnes I am not sure about you're meaning, but as my application does not boot, I am not really able to say if it really run slower. My bootloader just configure the Clock, QSPI and now the SCB, Mapped the flash and jump to the app. This seems OK. But the startup of the app is failing on this hardware (was perfectly working on this same board before).
@Community member Stack alignment => This will never work on any board right ? I use this exact same code on another board with no issue.
Pushing FPU registers without the FPU being enabled. => Not sure here
Initializing External memories you haven't configured or set up yet. => The startup code running in Xip from the QSPI seems to work in debug, step by step mode. so the external flash is correctly configure I guess.
Touching internal SRAMs who's clocks you haven't enabled. => The 3 RAM /domain clocks are enabled in the bootloader. No reason to be disabled here.
Using above SRAM for stack. => the stack is empty at this stage or almost. and also should never work right ?
Maybe usefull, but when halting in the hardfault, my working register are bad (from r0 to r3 used for copying the datas). But in step by step mode, looks like it does not happen. I finish the copy without any fault. but as soon as I run, i got an hardfault anyway later.