cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on Periph_to_mem DMA transfer started from an interrupt

Posted on May 15, 2013 at 19:00

I need advice on the following problem.

I have to connect an external hardware generating 32-bit values at a continuous rate of 1536 kHz to a GPIO port of a Cortex M4F CPU, that of the STM32F4 Discovery board, which I am using as a proof of concept before committing for the production of the final PCB.

I had thought to use the DMA to fill a 512-entry buffer, in double buffered mode, alerting the CPU when one of the two flip-flop buffers is filled. This seems to not present problems.

What I am not sure is how to communicate to the DMA controller that a new sample is ready on the GPIO port. First of all, can the DMA be used this way ? IOW, can it be controlled by an EXTI interrupt generated by a pin of a GPIO port (of course not the same port where the samples are arriving from).

To summarize, the flow should be this :

- A new 32-bit sample is set on the pins of a GPIO port.

- A pin of another port is toggled to tell to the DMA controller to read that value and to deposit it in  memory, incrementing the memory address.

- When the count of samples reaches 512, a buffer switch happens, and an interrupt is generated to the CPU, which will then process the just filled buffer. So what I need is a way to trigger a DMA request by toggling a pin of a GPIO port. Is this possible ?

A snippet of code on how to initialize the NVIC and the DMA controllers would be much appreciated, thanks.
11 REPLIES 11
Posted on May 18, 2013 at 19:03

> IMO you just need to do it in reverse, STM32 as a master generating data clock/request.

Yes, that in theory would be a good solution, but I fear that there are hardware considerations that preclude that way...  anyway I will talk to the hardware designers to see what they will say about that. 

armindavatgaran
Associate III
Posted on May 01, 2015 at 13:55

Hello

Which stream and channel could be used for gpio to memory transfers using dma?

Thanks.