Pyboard D SPI DMA

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
Sleepy_Reenigne
Posts: 5
Joined: Wed Mar 04, 2020 10:07 pm

Pyboard D SPI DMA

Post by Sleepy_Reenigne » Fri Oct 23, 2020 9:15 am

Hi,

I'm looking to use DMA for SPI, the application is reading from an ADC (ADS1299).
I found the following (https://github.com/micropython/micropython/pull/5721), but rlourette says that "This would be implemented differently on the Pyboard D for instance as its DMA controller has double buffer mode".

Does anyone know if SPI+DMA has been implemented on the Pyboard D - or how much of a challenge it would be to adapt rlourette's work?

Any help would be greatly appreciated

User avatar
jimmo
Posts: 2015
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Pyboard D SPI DMA

Post by jimmo » Fri Oct 23, 2020 11:39 am

Sleepy_Reenigne wrote:
Fri Oct 23, 2020 9:15 am
Does anyone know if SPI+DMA has been implemented on the Pyboard D
All STM32 boards use DMA for SPI (see ports/stm32/spi.c). The issue here (and I suspect likely why this is relevant to you) is that the high-level Python functions are blocking. i.e. even though they use DMA internally, they block waiting for the operation to complete before returning back to the user. The issue here is how to build a good Python-level API for DMA. Off the top of my head the issues are things like buffer management and re-entrancy, but I think there was much more discussion of this stuff in the PR you linked to.

So while there are some differences between different STM32 families in terms of the DMA peripheral support, the much more difficult part is how to implement DMA-from-Python more generally.

Sleepy_Reenigne
Posts: 5
Joined: Wed Mar 04, 2020 10:07 pm

Re: Pyboard D SPI DMA

Post by Sleepy_Reenigne » Mon Oct 26, 2020 8:22 am

Thank you for that insight Jimmo!

Post Reply