Hi,
I am working on optimize the SPI timing for an NFC reader IC which connected to nRF52840, to minimize the read/write time as much as possible.
And I notice that the time between each read/write reg takes about 40us when spi-max-frequency = <8000000>.
Then I wrote a code snippet to call spi_transceive directly:
uint8_t start_reg = 0x74;
uint8_t reg_value = 0;
const struct spi_buf tx_buf = {
.buf = &start_reg,
.len = 1
};
const struct spi_buf_set tx = {
.buffers = &tx_buf,
.count = 1
};
/* Read register value. */
const struct spi_buf rx_bufs[] = {
{.buf = NULL, .len = 1},
{.buf = ®_value, .len = 1}
};
const struct spi_buf_set rx = {
.buffers = rx_bufs,
.count = ARRAY_SIZE(rx_bufs)
};
int test_reg_read(void)
{
int err = spi_transceive(spi_dev, &spi_cfg, &tx, &rx);
if (err) {
LOG_ERR("SPI reg read failed, err: %d.", err);
return err;
}
return 0;
}
// In a seperate thread
for (size_t i = 0; i < 200; i++) {
test_reg_read();
}
With the code, the SPI waveform like this:
28us between each read/write.


Is it possible to reduce the time between each spi read/write?
I am using ncs2.5.2
Regards,
Anthony
