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

SPI master and DMA

Using softdevice s132, nRF52832 on a custom board

I don't quite understand how does the SPI work exactly?

I am using it on a battery powered low power sensor application, for this instance I have not set up a SPI event handler, but DMA is enabled.

I am calling nrf_drv_spi_transfer in a function, where I return the recieved data to the function that called it.

The SPI is running at 1mhz - so what is the CPU doing while waiting for the SPI slave to clock in the bytes?

Do I risk that I am working on memory that is not updated from the most recent info from the SPI peripheral device, or is the CPU waiting for the transfer to complete?

Should I set up the SPI event handler and instead signal my app to check the data after the event has indicated SPI transfer event is done - intuitively it seems like a better real-time/low power solution but this may already be sorted and abstracted away in the driver?

Parents
  • Any particular reason why you don't use SPI Master driver from nRF5 SKD? It shouldn't have any flaws for battery powered app... also formulation "what is the CPU doing while waiting for the SPI slave to clock in the bytes" doesn't make sense because SPI Master is not waiting for anything normally, it must driver CLK signal so slave can output data on MISO line. If you have another (usually called "interrupt") line from Slave to Master which signals that now Slave want's to talk (so Master must provide CLK and listen on MISO) then simply put the MCU to POWER ON SLEEP and wait for GPIOTE interrupt...)

Reply
  • Any particular reason why you don't use SPI Master driver from nRF5 SKD? It shouldn't have any flaws for battery powered app... also formulation "what is the CPU doing while waiting for the SPI slave to clock in the bytes" doesn't make sense because SPI Master is not waiting for anything normally, it must driver CLK signal so slave can output data on MISO line. If you have another (usually called "interrupt") line from Slave to Master which signals that now Slave want's to talk (so Master must provide CLK and listen on MISO) then simply put the MCU to POWER ON SLEEP and wait for GPIOTE interrupt...)

Children
No Data
Related