Page 1 of 1

SPI and DMA

Posted: Tue Feb 14, 2017 8:26 pm
by kamikaze
I've found this code

Code: Select all

status = HAL_SPI_Transmit_DMA(self->spi, (uint8_t*)src, len);
if (status == HAL_OK) {
    status = spi_wait_dma_finished(self->spi, timeout);
}
What is the purpose in DMA if we are still placing CPU on pause until job is done? :roll: Is there any way to get this done async?

Re: SPI and DMA

Posted: Tue Feb 14, 2017 8:44 pm
by dhylands
Well, the big advantage is that the DMA engine can feed the data and doesn't get slowed down by things like interrupts or other processing happening on the system. I know that if you don't use DMA, it's possible to underflow on the sdcard FIFO, for example, if just doing using the CPU.

I would also like to see an option for async I/O (I2C, SPI, UART) where some type of completion callback occurs when the I/O has "finished".

Re: SPI and DMA

Posted: Wed Feb 15, 2017 7:52 pm
by marfis
dhylands wrote: I would also like to see an option for async I/O (I2C, SPI, UART) where some type of completion callback occurs when the I/O has "finished".
yeah, me too.