I've got some code which uses the ASF SERCOM SPI driver on a SAMD21J18A, and it's been working well enough for the most part. However, while trying to implement something new, I started getting hardfaults - the code isn't exactly right yet, so I'm not shocked, but in trying to track down what exactly is causing the faults, I still don't understand.
I enabled the MTB, and it seems to be indicating that the last code running before it hit my fault handler was line 1323 of sam0/drivers/sercom/spi/spi.h:
*rx_data = (uint8_t)spi_module->DATA.reg;
... am I missing some way for this line to be causing a hardfault? rx_data should be pointing at a static variable in my code at this point (I double-checked, it's pretty simple), so I'm not sure what's going on. Any thoughts?