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

Single SPI transfer from PPI

I want to set up a SPI transfer so the transfer itself is triggered by PPI. The PPI is set up working, the chain of events is

  1. Timer CC0 -> Set CS low
  2. Timer CC1 -> Start SPI
  3. SPI end -> Set CS high

Now, I want to send a packet of 2 bytes for transmission on the next timer event (note this is TX only, no RX)

My SPI descriptor is

static uint8_t dac_buf[2];
nrfx_spim_xfer_desc_t const xfer_desc = NRFX_SPIM_SINGLE_XFER(dac_buf, 2, NULL, 0);

and I send the packet by

nrfx_spim_xfer(&spi_inst, &xfer_desc,NRFX_SPIM_FLAG_HOLD_XFER);

but I'm getting the same 2 bytes sent every timer event. Can I expect the single xfer to work like this, or do I need to be enabling/disabling the PPI channels to start/stop transmission?

Related