This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

SPI hangs within RTC CC callback

Hi all,

I'm transferring data to and from an Atmel AT25040 NVRAM using SPI, and it works perfectly when run within main(). However, if I run the same code from within an RTC CC callback, the blocking call to nrf_drv_spi_transfer() never returns.

Any suggestions gratefully received!

Parents
  • Hi,

    What kind of interrupt priorities do you use? If you are calling a blocking function from within an interrupt it might be that the SPI transfer is waiting for the RTC interrupt to complete. However, this will never happen if you use a blocking nrf_drv_spi_transfer() from within the RTC interrupt itself, because even a blocking nrf_drv_spi_transfer() is waiting for an SPI interrupt, only behind the scenes deep down in the drivers. If you haven't done so already, can you try to increase the interrupt priority of the SPI driver, to something higher than the RTC interrupt? You can do it in sdk_config.h.

Reply
  • Hi,

    What kind of interrupt priorities do you use? If you are calling a blocking function from within an interrupt it might be that the SPI transfer is waiting for the RTC interrupt to complete. However, this will never happen if you use a blocking nrf_drv_spi_transfer() from within the RTC interrupt itself, because even a blocking nrf_drv_spi_transfer() is waiting for an SPI interrupt, only behind the scenes deep down in the drivers. If you haven't done so already, can you try to increase the interrupt priority of the SPI driver, to something higher than the RTC interrupt? You can do it in sdk_config.h.

Children
Related