SPI and DMA

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
User avatar
kamikaze
Posts: 128
Joined: Tue Aug 16, 2016 10:10 am
Location: СССР
Contact:

SPI and DMA

Postby kamikaze » Tue Feb 14, 2017 8:26 pm

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?

User avatar
dhylands
Posts: 2374
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada
Contact:

Re: SPI and DMA

Postby dhylands » Tue Feb 14, 2017 8:44 pm

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".

User avatar
marfis
Posts: 136
Joined: Fri Oct 31, 2014 10:29 am
Location: Zurich / Switzerland

Re: SPI and DMA

Postby marfis » Wed Feb 15, 2017 7:52 pm

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.


Return to “The MicroPython pyboard”

Who is online

Users browsing this forum: No registered users and 1 guest