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

spi master send data error at sd_nvic_DisableIRQ

Hi all,

We have a issues with the SPI communication and hope someone could help us. Using SDK 8.0.0 and Soft Device S110 8.0.0

code process step:

  1. enable ble stack, and ble init.

  2. spi_master_init(SPI_MASTER_0, spi_master_0_event_handler, false); (spi init default: 1Mbps, MsbFirst, CPOL_ActiveHigh, CPHA_Leading, interrupt priority LOW) by call api: spi_master_open() and spi_master_evt_handler_reg()

  3. spi writer data using spi_master_send_recv()

  4. spi writer data using spi_master_send_recv(), and error occur at //Disable interrupt SPI. APP_ERROR_CHECK(sd_nvic_DisableIRQ(p_spi_instance->irq_type)); // line: 431, error code: NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE

why the error occur on the second spi communication, and the system stops ? Many thanks! terry.

  • Can you check if the irq_type value is `SPI0_TWI0_IRQn = 3, at the time of this call. If it is so, then this is some softdevice bug in that version. I see that in latest SDK they have removed the sd_call and called direct NVIC_ functions.

    Quick fix would be to replace all sd_nvic functions with NVIC_ functions directly.

    APP_ERROR_CHECK(sd_nvic_ClearPendingIRQ(p_spi_instance->irq_type));
    APP_ERROR_CHECK(sd_nvic_DisableIRQ(p_spi_instance->irq_type));
    APP_ERROR_CHECK(sd_nvic_ClearPendingIRQ(p_spi_instance->irq_type));
    APP_ERROR_CHECK(sd_nvic_SetPriority(p_spi_instance->irq_type, p_spi_master_config->SPI_PriorityIRQ));
    

    etc

    to

    NVIC_ClearPendingIRQ(p_spi_instance->irq_type);
    NVIC_DisableIRQ(p_spi_instance->irq_type);
    NVIC_ClearPendingIRQ(p_spi_instance->irq_type);
    NVIC_SetPriority(p_spi_instance->irq_type, p_spi_master_config->SPI_PriorityIRQ);
    

    etc

Related