cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030xx hitting random Hardfaults

patrickschneider9
Associate III

Hi guys,

I hope you can help me with this one:

In approximately 1 out of 100 devices we have some strange behaviour which ultimately boils down to a HardFault Interrupt which triggers a Watchdog Reset.

The majority of products in the field does not have this error, and the ones that does "randomly" generate it. Sometimes the stack trace is readable sometimes not, and when it is the hardfault hits at different parts of the code wihtout any obvious corelation to executed code or runtime (sometimes it hits after 2 minutes, sometimes after hours).

And now the most interesting part: I tried to isolate the error and started to remove parts of my code. Currently I have a blank while(1) main loop with an alive counter without any configured or enabled interrupts and still - the hardfault hits.

Do you have any ideas or clues what could cause such behaviour? I checked against all hardfault causes listed in the cortex-m0 manual but couldn't find anything promising.

What I have now is only clock init (hsi) -> startup code -> blank while(1).

I'm looking forward to any idea!

Cheers!

1 ACCEPTED SOLUTION
6 REPLIES 6
TDK
Guru

Incorrectly configured external memory, insufficient wait states. Listing the source(s) of the hard fault via the SCB registers would be helpful, even if they change "randomly".

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

You may also run your code using a "known good" hardware such as Nucleo or Disco, to exclude hardware-related problems.

JW

Flash related issues seem most likely.

Would look to external drivers, like power supply issues or manufacturing defects (opens, tombstoned capacitors, etc)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

So you're overclocking it? That info would have been useful to put in the OP.

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

Not really, it is running at 8MHz, but with PLL (where it is not needed).