How do I cancel a call to spi_transceive_cb()? Or, how do I safely change the MISO data when the nRF54LM20A is a SPI slave?

Hi,

As the subject says, I have an nRF54LM20A acting as a SPI slave. When I perform a call to spi_transceive_cb(), I don't have any data for TX (i.e. MISO). This runs until another chip acting as SPI master performs a SPI operation, at the end of which, the given callback passed to spi_transceieve_cb() is called. At that point, I can restart the call to spi_transceieve_cb() with any data that I want.

However, the problem is that I periodically need to update the TX data, and I need to do this safely. I am fine with the CPU taking and holding the SPI semaphore, which results in sending a bunch of DEF characters on MISO, but I have tried modifying the underlying tx buffer, and this doesn't seem to work.

When I want to add data periodically to the TX buf (for MISO), is it possible to do the following? 

  1. Cancel the current spi_transceieve_cb() operation.
  2. Write the tx_buf
  3. Restart the spi_transceieve_cb() operation.

If so, how would I do this?

Regards,
Tyler

Parents Reply Children
No Data
Related