Skip to main content
Alexandre T
Associate III
October 13, 2017
Solved

DMA_InitTypeDef explanation

  • October 13, 2017
  • 1 reply
  • 1586 views
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 ?

    This topic has been closed for replies.
    Best answer by Tesla DeLorean
    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.

    1 reply

    Amel NASRI
    Technical Moderator
    October 13, 2017
    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.
    Alexandre T
    Associate III
    October 13, 2017
    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 ?

    Tesla DeLorean
    Guru
    October 13, 2017
    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 VenmoUp vote any posts that you find helpful, it shows what's working..