Skip to main content
AWats.4
Associate
May 10, 2022
Question

INVSTATE hard fault with SPI interrupt handler. STM32F405

  • May 10, 2022
  • 2 replies
  • 1336 views

I'm attempting to have my program run some code when a SPI transfer is complete using the RXNE flag. Setting the RXNEIE bit invokes SPI2_IRQHandler() as expected but it always results in a hard fault (CFSR register = 0x20000), without any additions to SPI2_IRQHandler().

I don't have much experience in debugging of this kind so any help/tips would be appreciated.

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
May 10, 2022

Perhaps break-point the code an step it?

Make sure all the call-back addresses in the structure are properly populated

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
AWats.4
AWats.4Author
Associate
May 11, 2022

Reading the spi data register and clearing the RXNE flag in the first line of the interrupt handler seems to have fixed it.