Skip to main content
tioluwa
Visitor II
December 3, 2019
Question

How to fix Hard fault on STM32L0_EVAL board using STM32CubeIde

  • December 3, 2019
  • 1 reply
  • 987 views

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

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
December 3, 2019

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..