Skip to main content
Leonelf
Associate II
February 20, 2016
Question

STM32F072-DISCO UART DMA doesn't work

  • February 20, 2016
  • 5 replies
  • 1568 views
Posted on February 20, 2016 at 18:28

Code is in the Attatchments.

I'm trying to periodically send data over SPI and to receive data over USART. Sending over SPI w/ DMA works. But the USART DMA doesn't work. I can send whichever data I want, but the DMA wont trigger an interrupt. Disabling DMA and using UART interrupts works, the interrupt fires as soon as USART receives data, so my data or USART aren't to blame. 

Is there something wrong with my init routines? Or something else?
    This topic has been closed for replies.

    5 replies

    Tesla DeLorean
    Guru
    February 20, 2016
    Posted on February 20, 2016 at 20:54

    Make sure things like this are resolving to addresses, it looks ok, but the cast will hide any objections the compiler might make

    DMA1_Channel3 ->CMAR = (uint32_t) buffer[!currentBuffer][layer];

    This might be more explicit

    DMA1_Channel3 ->CMAR = (uint32_t) &buffer[!currentBuffer][layer][0];

    Check that the DMA isn't flagging some kind of error condition, and that your reinitialization of the DMA is sufficient to restart it.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Leonelf
    LeonelfAuthor
    Associate II
    February 20, 2016
    Posted on February 20, 2016 at 23:17

    I looked into the DMA flags. The error flag is 0, so no error :(

    Leonelf
    LeonelfAuthor
    Associate II
    February 26, 2016
    Posted on February 26, 2016 at 22:42

    bump

    waclawek.jan
    Super User
    February 27, 2016
    Posted on February 27, 2016 at 17:12

    What is the value of  SYSCFG_CFGR1.USART1_RX_DMA_RMP?

    JW
    Leonelf
    LeonelfAuthor
    Associate II
    February 28, 2016
    Posted on February 28, 2016 at 10:42

    I assume you meant SYSCFG_CFGR1_USART1RX_DMA_RMP? Its value is 0x400