cancel
Showing results for 
Search instead for 
Did you mean: 

DMA to GPIO output pins

rohanlal217
Associate II
Posted on June 28, 2016 at 17:39

I wish to transfer a large array of data to 8 output pins that are all on the same port. E.g. a 500 element 8bit array where each bit of each element represents the pin status.

So 500 independent transfers to the port would be required.

I have been looking through the examples that ST have but none of them seem to do this.

There seems to be a lot of 'DMA to PWM' examples which transfer to a pin that has a timer connected to it but this isn't useful to me since I want to transfer to a whole port.

How would I do this? Are there any examples similar to this which I could modify to my need?

Thanks
5 REPLIES 5
ferrario
Associate III
Posted on June 28, 2016 at 18:49

The exact implementation is STM32 model/family specific, but I've posted several dozen examples to the forum over the years. The search here is awful, try Google.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rohanlal217
Associate II
Posted on June 29, 2016 at 08:38

that guy uses PWM as well.

Also, Clive, I have found code that's exactly what I need in terms of what it does but it uses peripheral stuff and I have no idea how most of those functions translate to HAL unfortunately. So I don't think stuff thats very old will be of use to me.

This is it here.

https://github.com/Frans-Willem/LEDMatrixHUB75/blob/master/F4Matrix/src/matrix.c

rohanlal217
Associate II
Posted on June 29, 2016 at 22:33

I tried editting the simple DMA example in STM32Cube_FW_F7_V1.4.0\Projects\STM32F746ZG-Nucleo\Examples\DMA\DMA_FLASHToRAM

I changed the DMA direction register so its memorytoperipheral

instead of memorytomemory. And I changed the destination

memory address to one of the GPIO ports.

For some reason its not working though. The GPIO pins aren't being written to at all.

Here's the editted example code:

http://ideone.com/h1EJBr

rohanlal217
Associate II
Posted on June 30, 2016 at 15:45

actually that was the wrong link i gave sorry 

http://ideone.com/KJTf1v

I got it working. It wasn't working was because i had DMA_MEMORY_TO_PERIPHERAL instead of DMA_MEMORY_TO_MEMORY Even though the former way is obviously the correct way. Could this be a bug?