This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Inside GPIOTE interrupt handler the SPI transaction never ends

Hi,

I am sensing interrupts on a pin using GPIOTE. I can see the interrupts coming on the oscilloscope. The firmware also detects the interrupts. However once I am inside the interrupt function, if I want to do a SPI transaction (in my case it is to retrieve data conversion of an ADC), then I never end the transaction. In fact the MISO line works fine (on the first conversion) as I can see on the oscilloscope. However after the transaction is done, the SPI peripheral should issue an interrupt to say the transfer is done but it does not.

I have been careful to set the code as non optimized, and I have given higher priority for the SPI than for the GPIOTE. By the way the SPI works well in normal mode when I configure the sensor registers (I verified with the oscilloscope)

Here is the oscilloscope picture with DRDY (interrupt) and MISO on first conversion (on the next conversions the MISO stays low):

#

Here is the SPI transaction code in the GPIOTE interrupt handler code (where rc is successful but xfer_done does not get true:

RetCode rc = RetCode::SUCCESS;
xfer_done = false;
rc = m_spi->Transfer(NULL9, &spi_rx[0], 9spi::NO_FLAGS);
ASSERT_ERR(rc);
while (!xfer_done) { WFE }

To recreate it, I would say that you need to set the GPIOTE priority level to 3 and SPI priority level to 2 and get interrupts with GPIOTE and try to do a SPI transaction.

I use the nRF52832 with SDK14 without softdevice.

Thanks

Parents Reply Children
Related