Good evening all,
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.
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 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.
A snippet of code on how to initialize the NVIC and the DMA controllers would be much appreciated, thanks.
Sorry for not having been more specific... the final product will consist of a single board with all the acquisition ADCs and DDCs together with the STM32F407VTG processor. For the time being I am developing a prototype (a proof of concept) using the STM32F4 Discovery board, just to be sure, before designing and producing the final board, that "it can be done"... :-)
No, I searched the examples published by STM, but there are no examples of a DMA whose transfer is triggered by the toggling of a GPIO pin... there are many examples of DMA, but in all those examples the DMA is triggered by a more specific action, like a timer, or an UART, or some such.
Or maybe such an example does exist, but I was unable to find it....