Skip to main content
blue_dolphin1987
Associate III
December 5, 2013
Question

DMA Peripheral Base Address

  • December 5, 2013
  • 2 replies
  • 1310 views
Posted on December 05, 2013 at 07:46

Hi ,

I am new to Stm32 . While browsing through the examples i noticed something that i dont understand for DMA . In the DMA-UART example,

// In the initialzation code 
DMA_InitStructure.DMA_PeripheralBaseAddr = USARTy_DR_Base;
// In the header file
#define USARTy_DR_Base 0x40004404

From the datasheet , UART2 is at 0x4000 4400 - 0x4000 47FF. Why does the header file defines it at 0x 4000 4404 ? Thanks
    This topic has been closed for replies.

    2 replies

    francescatodiego
    Associate III
    December 5, 2013
    Posted on December 05, 2013 at 12:24

    The uart perhiperal target/source for DMA transfer is the UART data register (USARTy_DR)

    offset 0x00000004 in uart perhiperal register area.

    (See Usart register map table in device reference manual)

    Config also

    DMA_InitStructure.DMA_PeripheralInc      = DMA_PeripheralInc_Disable;

    DMA  transfer always read from/write to same register (or address if you prefer)

    Tesla DeLorean
    Guru
    December 5, 2013
    Posted on December 05, 2013 at 13:02

    Personally I think the following form is a bit more portable

    DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&USART1->DR;

    // Register transfer goes to/from
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..