DMA made easy : a dma driver

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
User avatar
alex31
Posts: 374
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 61 times
Contact:

DMA made easy : a dma driver

Postby alex31 » Wed Apr 11, 2018 6:53 pm

The driver can be found in a collection of utilities that are gathered here : git@github.com:alex31/chibios_enac_various_common.git

the driver is on only two files : hal_stm32_dma.h and hal_stm32_dma.c

Goals

I have initially wrote this driver for my lectures, to let dma be easier to manage for my students. When they address dma, they are already accustomed to the chibios driver API : most of the complexity and hardware dependant stuff is in a configuration structure, and the functions are few, and simple to use.

Pro

Mimic other ChibiOS drivers, offer both asynchronous and synchronous api (like the ADC driver), manage timeout, both in one shot (synchronous) or continuous (asynchronous) mode.

Cons

tested on dmav1.1, dmav2, should work on dmav1 (not tested), but do not address new dma : bdma, dmav3, mdma, dmamux. Will have to eventually add theses beasts, and it will complicate the structure : 2 files will no more be enough, and i will have to follow the classic hardware independent + low level + .mk structure.

nearly all the DMA registers are mirrored in the configuration structure, but the mem1p field. At first, like in ChibiOS, i was thinking that in any case half buffer scheme is sufficient, but, after thinking about, implementing double buffer operations would be interesting : one can use memory pool or linked list, without spurious copies, instead of double buffer based operations.

Examples of use can be found here : git@github.com:alex31/stm32_dma_examples.git
each branch is a different example (p2m m2p, m2m, continuous, one shot, etc etc)
examples are done using a f407 custom board, but can be easily port to other dma v1.1 ou dmav2 based stm32.

Alexandre

Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 11 guests