Hi,
I'm BLE-sending out Sensor values using a nrf52832. When the sensor gets a (new) value an interrupt is generated and the nrf then transfers the value in the gpiote inerrupt handler via SPI from the sensor. Therefore 2 SPI Commands like the following example are needed:
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, 1, m_rx_buf, 2));
while (!spi_xfer_done) { __WFE(); }
spi_xfer_done = false;
When the SPI Transfers are done the sensor resets the interrupt. However for my application it's important that this reset is as fast as possible, so in other words the SPI transfer has to be as fast as possible. I already optimized my code and tested with different Compiler Optimization Levels. The time between the falling and rising edge of the interrupt is measured with an oscilloscope. At the moment It takes ablut 65 microseconds to reset the Interrupt. Now I've noticed that when I add "NRF_LOG_HEXDUMP_INFO" to the int_handler after getting the sensor values the Interrupt time is reduced to 50 microseconds. So adding this line of code seems to speed up the execution time of the SPI commands. How is that possible? Is there a way to speed it up without the Hexdump_Info?
static void int_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
uint8_t sensor[2];
getValues(sensor);
NRF_LOG_HEXDUMP_INFO(sensor, 2);
}