cancel
Showing results for 
Search instead for 
Did you mean: 

DMA_InitTypeDef explanation

Alexandre T
Associate II
Posted on October 13, 2017 at 18:02

Can someone explain me how to use the 'PeriphInc' in the DMA_InitTypeDef.

I understood that it can read several address (is that right ?), but where I write the start and end adress ?

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on October 13, 2017 at 21:44

It is pretty simple, but they both need to be within the addressable space of the processor.

An SPI based peripheral is going to get accessed by repetitive reads of &SPI1->DR, an address that ISN'T incrementing.

If the registers in the accelerometer are 16-bit and there are 3 of them, you'd program the DMA to transfer 6-bytes, and you'd be dependent on the external device to 'auto increment' its internal register address.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

6 REPLIES 6
Amel NASRI
ST Employee
Posted on October 13, 2017 at 19:04

Hi

alexandre.julien

‌,

Taking the example of STM32CubeF7, I checked the

http://www.st.com/content/ccc/resource/technical/document/user_manual/45/27/9c/32/76/57/48/b9/DM001897pdf/files/DM001897pdf/jcr:content/translations/en.DM001897pdf

(Description of STM32F7 HAL and Low-layer drivers) where I found following description (p275):

uint32_t DMA_InitTypeDef::PeriphInc Specifies whether the Peripheral address register should be incremented or not. This parameter can be a value of DMA_Peripheral_incremented_mode

Please refer to the description of this structure in order to know more about all the fields.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on October 13, 2017 at 20:26

Yes I already read it but in fact, I don't understand what it means. Does it means that I can do multiple reads on several address ? If so, how can I write the start and end adress ?

Posted on October 13, 2017 at 21:12

You define the direction of the transfer, and the length in transfer units.

You specify the source and destination addresses using HAL_DMA_Start(), which is the peripheral depends on the direction. It will be the source address in the 'from peripheral' case.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 13, 2017 at 21:24

Sorry but I still don't get it. 

For example :

If I want to do multiple reads (I have an accelerometer and I want to read x,y,z values),

Do I need to configure several DMA or is it possible to do it with only one ?

Posted on October 13, 2017 at 21:44

It is pretty simple, but they both need to be within the addressable space of the processor.

An SPI based peripheral is going to get accessed by repetitive reads of &SPI1->DR, an address that ISN'T incrementing.

If the registers in the accelerometer are 16-bit and there are 3 of them, you'd program the DMA to transfer 6-bytes, and you'd be dependent on the external device to 'auto increment' its internal register address.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 13, 2017 at 21:52

Thank you, that's the answer I was waiting for !