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

Are SPI interrupt disabled in GPIOTE handler?

I am writing code for nrf51822 with softdevice and an accelerometer is connected to the nrf chip. The accelerometer provides interrupt to nrf chip over GPIOTE whenever there is data available to read. Upon receiving the GPIOTE interrupt, I am reading accelerometer data over SPI using nrf_drv_spi_transfer() and the SPI event handler that I have written(This even handler is hit when read is completed).

Since I have 3 axis data I am calling nrf_drv_spi_transfer() 3 times from the GPIOTE handler(for reading x, y and z axis data). But the SPI even handler is never reached.

Are SPI interrupt disabled in GPIOTE handler? I have set APP_IRQ_PRIORITY_LOW to GPIOTE handler.

Parents
  • Thanks Jørgen, the issue got resolved when I changed SPI_DEFAULT_CONFIG_IRQ_PRIORITY in sdk_config.h from 3 to 2. But I found this comment in sdk_config.h.

    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    
    #ifndef SPI_DEFAULT_CONFIG_IRQ_PRIORITY
    #define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 2
    #endif
    

    Does this mean that I cannot call softdevice APIs from the SPI event handler now?

Reply
  • Thanks Jørgen, the issue got resolved when I changed SPI_DEFAULT_CONFIG_IRQ_PRIORITY in sdk_config.h from 3 to 2. But I found this comment in sdk_config.h.

    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    
    #ifndef SPI_DEFAULT_CONFIG_IRQ_PRIORITY
    #define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 2
    #endif
    

    Does this mean that I cannot call softdevice APIs from the SPI event handler now?

Children
Related