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

spi interrupt doesn't work in BLE event using SDK13.0.0

Hi,

I'm working on migration from project based on SDK12.1.0, 132SD3.0.0 (calling A project) to the one based on SDK13.0.0, 132SD4.0.2 (calling B project). I developed the project by adding codes to ANCS sample. So, migration is being done by adding the same codes to the SDK13.0.0's one.

In the A project, I call the I2C and SPI communication on ble write event to display text on OLED. I2C is for OLED power, SPI is for communication between OLED and nRF52832. So I2C is first order, then call SPI. Both uses interrupt mode, not blocking mode. like below (SPI).

static void sf_spi_handler(nrf_drv_spi_evt_t const * p_event)
{
     s_spi_xfer_done = true;
     return;
}

static void sf_spi_lis2ds12_write(uint8_t address, uint8_t data_sdi){
     // Initalize buffers.
     uint8_t tx_data[] = {0, 0};
     uint8_t rx_data[] = {0, 0};

     tx_data[0] = (address | ACCELERATOR_WRITE_ADDRESS_MASK);
     tx_data[1] = data_sdi;

     // Start transfer.
     uint32_t err_code = nrf_drv_spi_transfer(&s_spi_instance, tx_data, sizeof(tx_data), rx_data, sizeof(rx_data));
     APP_ERROR_CHECK(err_code);
     while(!s_spi_xfer_done) {
        __WFE();
     }
     s_spi_xfer_done =false;
}

This works fine. However, in the B project, this flow cause SPI hung. I2C works fine. The both IRQ_PRIORITYs are 6 and the same as the A project's ones.

My Assumption:

Both behavior is weird. Ble dispatch priority is 3, so SPI and I2C priority are lower than BLE. Then SPI and I2C IRQ must be never called in ble dispatch.

Question:

1.Why IRQ behaviors are different in A and B project?
2.My Assumption is correct?

Thank you.

Related