cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault in Function CRC_Lock

jimmii
Senior II

Hi,

I'm using the STM32H750 Discoveryboard.

When running my code from TouchGFX Designer, everything works fine.

But when running with Keil IDE, something strange is happening:

-Flashing the application and loading with the debugger -> hard fault occurs in funtion crc_lock

If I unplug and replug the board, the application starts just fine. Only when connected to the debugger, the hard fault occurs.

Do you have any hints?

__HAL_RCC_CRC_CLK_ENABLE is being called, so that shouldn't be a problem

Thanks.

42 REPLIES 42

There is other code in the library that checks the chip stepping. For example the VOS or others.

Should perhaps catch the zero state.

Definitely seen the zero read issue in Keil over the years.​

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

I did a small program that prints "CRC Check failed!" using no generated glyphs in case the lock fails for some reason: 1) CRC not enabled 2) Wrong response (Unknown Device ID either non-STM32 or DBGMCU unreadable). But this requires the display to function properly. I'm not sure if we're even interested in this kind of fallback, but it would definitely save me some "groundhog day" moments writing "Enable CRC and check that DBGMCU is readable" =)

/Martin

Error handling is THE most difficult issue in programming. There is no one universal good solution and most of the programs and libraries simply defer the problem by setting some variable nobody ever checks or returning an error code which is usually not informative and nobody cares to take any specific action upon it...

So this solution sounds to be perfect, given circumstances.

JW