STM32F103R8 - Random Hard Faults on simple(?) project
- February 11, 2021
- 1 reply
- 1665 views
Full disclosure. I'm new to STM32 and i'm porting from Arduino based 8 bit code to run on an STM32F103R8T6. This is on a manufactured / assembled PCB with supposedly genuine micro and not a random ebay blue pill board.
While debugging I'm getting random hard faults after about 30 seconds of runtime with no obvious reason why. I've selected the right device in CubeMX and presumed that the generated code would be correct.
To add to the strangeness when not running the debugger it takes longer before locking up.
To diagnose I've literally cut the project down to a LCD hello world project with a followup LCD print in a loop. Next step will be debugging via the toggling of a single pin.
I've read that hard faults are usually a memory issue and I'll admit I've not changed any project settings related to memory mostly because I have absolutely no idea how so technically i'm running the default settings.
In this instance though according to the stack trace I'm returning from a function that's simply toggling a pin. As far as I understand it from what i've read there is no way this should be causing a hard fault as it's completely unrelated to memory
I'm obviously hoping that someone can point me to what I might be doing wrong. Thanks in advance.
Edit:
Other properties at time of failure:
_rs_pin Pin is PB12
_rs_pin: 4096
_rs_port: 0x40010C00 // Is there are reference for checking these?
