cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix Hard fault on STM32L0_EVAL board using STM32CubeIde

tioluwa
Associate

Hello,

I am experiencing a hard fault when executing the following line of code:

hourly_log.credit = *credit_register.

The screen shot bellow shows the debug window at the time of the fault, with the variables, disassembly view, and registers.

The code in question has been working perfectly on an old 8bit platform, now i'm trying to port it to the STM32 platform, and i'm running into some problems.

I'll appreciate some help with this issue.

Thanks

0690X00000AtG8GQAV.png

1 REPLY 1

The CM0 can't do unaligned memory reads, ie a 32-bit read from an ODD address 0x20000EF5

So you can't used unaligned pointers in this fashion, you'll need to do a byte wise read and reconstruct the work, or memcpy() to an aligned local variable.

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