2025-12-21 12:01 AM - edited 2025-12-21 12:03 AM
Hello,
I am working on a hobby project with https://www.st.com/en/microcontrollers-microprocessors/stm32f767zi.html.
I have my own build and development environment based on arm-gcc-none-eabi and CMake and all HAL Drivers and Libraries from STM.
The board starts properly up and I have started to work with GPIOs. Most of my initialization routines are copied from Example Projects. I think, that they are very similar, but I´m not 100% sure yet.
While initializing the LEDs, the MCU produces a HardFault (and sometimes a Memory Fault) from within the HAL Code. Currently HardFault occurs very consistently. First I want to take care about the HardFault and if MemFault is still occuring, I want to take care of this as well.
The error is thrown exactly at this line:
Configurable Fault Status Register has:
precise error bit set
bfarvalid bit set
The value in BFAR Register is: 0x46bd3718 which is the address of:
GPIOx->OSPEEDR register
This exact register is read in the line, that is causing the HardFault.
I assume, my initialization routines are missing something, or the initialization order is wrong, or some type of Clock Configuration does not fit yet (SPEED Register).
What are the requirements for read access to this Register?
Or can anyone give me a hint how to find the error?
User manual describes it as Read/Write accessible.
Thanks in advance and Best Regards.
Dietrich