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

SPI blocking or nonblocking?

Just to make sure: Will The spi_master_send_recv return when it is done writing and reading, or do you have to have some event wait functionality listening to SPI_MASTER_EVT_TRANSFER_COMPLETED ? I guess it is blocking because you have an output buffer as well...

I am going to do large burst reads having <= 24576 bytes. Is it even possible to read that much in one go memory wise?

Thanks!

Parents
  • The spi_master_send_recv function will only transmit first bytes to start the transaction and then return. This is non blocking.

    After the bytes are received for the transmitted first bytes then the rest of the transaction happens in the interrupt context. When the interrupt context has started for the first time you get a SPI_MASTER_EVT_TRANSFER_STARTED event and when the whole transaction is finished then you get SPI_MASTER_EVT_TRANSFER_COMPLETED event.

  • Thanks!

    The callback function is in place, and it is waiting. I was thinking more of nrf_delay_us as "sleep". I feel that it's "dirty" to sleep and check a volatile bool if it's done. Is there some Event framework I can use for signaling it from the SPI callback ? Like:

    wait_for_event(_eventObject, timeout);

    .....

    Handler:

    signal_event(_eventObject);

Reply Children
No Data
Related