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

spi_event_handler is not being triggered inside of a timeout_handler function

I am working on a ble peripheral project on the nrf52832. When I make an SPI transfer inside the main loop the spi_event_handler function gets called with no issues. After initializing SPI in the main loop, I am using a timer to read the SPI slave at a certain interval, but the spi_event_handler is not being called in this case. If I leave this block of code:

while (!spi_xfer_done) { __WFE(); }

after a transfer inside the timeout handler then the program gets stuck here indefinitely. If I take this statement out then the SPI transfer works, but it takes too long for my application. It sends the first two bytes and then waits for about 100us before sending the rest. Inside the main loop where I am initializing and reading from SPI everything works fine and takes as long as it should to complete SPI transfers.

The only thing I could think of that may be causing this is something set within the power_manage function.

Related