Skip to main content
LMehm
Associate III
February 15, 2019
Solved

STM32L0 strange behaviour.

  • February 15, 2019
  • 3 replies
  • 1008 views

Hello!

I have some strange behavior with STM32L0 processor.

I get Hard fault error in my function and I can't understand why this happens?!

I have equivalent codes - one of them works and other doesn't work causing Hard fault error.

Also this happens only when function is called with parameter mCopy=2.

I use SystemWorkbench for STM32 IDE.

I have attached these two codes - working and problematic code.

Would you please help me!

Thank you!

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    The trick here is to look at what the processor is complaining about. The Hard Fault points to the faulting instructions and has register content.

    The CM0 doesn't like unaligned 32-bit reads, ie (addr & 3) != 0

    3 replies

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    February 15, 2019

    The trick here is to look at what the processor is complaining about. The Hard Fault points to the faulting instructions and has register content.

    The CM0 doesn't like unaligned 32-bit reads, ie (addr & 3) != 0

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    LMehm
    LMehmAuthor
    Associate III
    February 16, 2019

    Thank you, Clive!

    I will check it!

    LMehm
    LMehmAuthor
    Associate III
    February 18, 2019

    Problem is solved!

    Thank you, Clive!