I'm using SPI communication to interface with an external ADC. I need to send first 1 byte, wait at leas 8us, and then send 3 bytes. I implemented this in 2 different spi_device_transmit (because I need to wait 8us between them).
Code: Select all
spi_transaction_t t;
t.flags = SPI_TRANS_USE_TXDATA | SPI_TRANS_USE_RXDATA;
t.length = 8*1;
t.rxlength = 8*1;
t.tx_data[0] = 0xFF;
t.tx_data[1] = 0xFF;
t.tx_data[2] = 0xFF;
t.rx_buffer = NULL;
spi_transaction_t r;
r.flags = SPI_TRANS_USE_TXDATA | SPI_TRANS_USE_RXDATA;
r.length = 8*3;
r.rxlength = 8*3;
r.tx_data[0] = 0xFF;
r.tx_data[1] = 0xFF;
r.tx_data[2] = 0xFF;
r.rx_buffer = NULL;
spi_device_transmit(spiHandler, &t);
spi_device_transmit(spiHandler, &r);
There's no other tasks running concurrently.
Is there a way to reduce this time between transactions?
In this case, SPI is configured to run at 2MHz (maximum speed to interface with my ADC).