cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 Hard and Memory Faults

DietWall
Associate II

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:

https://github.com/STMicroelectronics/stm32f7xx-hal-driver/blob/e1446fa12ffda80ea1016faf349e45b2047fff12/Src/stm32f7xx_hal_gpio.c#L191

 

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

 

 

20 REPLIES 20

I want to upload it to github within the next days. Is it ok to give you the link instead?

I want to open-source it and am kind of afraid about ST, or anyone else having legal claims against me, because HAL, Drivers and more is part of the project. Therefore I want to make sure, the licensing information is provided and exactly what I want it to be.

 

And the HardFault is solved since yesterday. I just did not had the time yet to re-check all initialization against a generated project.

 

 


@DietWall wrote:

And the HardFault is solved since yesterday. 


So if the Hard fault was solved, what kind of issue is remaining then? and how did you solve that?

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.

@DietWall wrote:

 I want to make sure, the licensing information is provided and exactly what I want it to be.


The HAL licensing documentation is available on the 'Documentation' tab of the Cube-F7 Product Page:

https://www.st.com/en/embedded-software/stm32cubef7.html#documentation

 


@DietWall wrote:

And the HardFault is solved since yesterday.


So please mark the solution.

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@Andrew Neil wrote:


So please mark the solution.


Need to tell how it was solved first ;)

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.
DietWall
Associate II

There were 2 invocations of HAL_GPIO_Init(). One directly from main and the other hidden inside BSP_LED_Init().

The second invocation caused the Hardfault. After commenting it out, code was stuck inside HAL_Delay(). It looked like the underlying counter was not incremented, thus not leaving this while loop implemented inside Delay.

I would like to keep this thread open, until some first functionality works, then I want to press "Accept as Solution"

As I requested before you need to share your complete project so we can test it from our side.

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.
TDK
Super User

How do you expect people to help if you don't share the code that is at fault?

CubeMX will happily generate the initialization code. Perhaps use that.

Calling HAL_GPIO_Init multiple times for the same pins does not cause a hard fault.

If you feel a post has answered your question, please click "Accept as Solution".
DietWall
Associate II

Guys.... Relax.... Christmas is near :)

 

I´m not looking for help right now (actually since yesterday afternoon), but trying to solve the issue on my own. Once I´m done I´ll describe the issue and the solution. If not, I will describe a different one.

Is this wrong??

Not wrong is start learn STMS with F7 same as sit in Maserati without driver license. Good luck

Thanks, luckily I have driven F1 cars before :)

Just to stay in that metaphor.