This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Task switching HardFault on Cortex-M0+ (arduino)

Hi All,

I am using an Arduino SAMD21 Cortex-M0+ board, and I am working on a preemptive task switcher which almost works except for one thing. If I trigger PendSV from SysTick it works, if I trigger PendSV from main program via yield() it works, but if I do both (use yield and also have an interrupt) then there is a hard fault. This is my Arduino sketch that rerpos the issue.. Inside the HardFault handler the stacked PC is 0xFFFFFFF8 and LR is pointing to the instruction in the Arduino's SysTick_Handler after it calls the sysTickHook(). Any idea how to debug this issue or what could be the cause? Thank you!


0