Page 1 of 1

UART driver and full DMA support  Topic is solved

Posted: Fri Sep 07, 2018 9:01 am
by Cesare
Hi,
I am developing with STM32F072RB, on its reference manual (RM0091 DocID018940 Rev 9) the table 30 at page 194 shows that to USART3_TX and USART3_RX can be assigned DMA channels 2 and 3 setting the remapping bit in register SYSCFG_CFGR1.

If I edit mcuconf.h as follows:

Code: Select all

#define STM32_UART_USART3_RX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 3)
#define STM32_UART_USART3_TX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 2)

and compile, I get this error:

./os/hal/ports/STM32/LLD/USARTv2/hal_uart_lld.h:472:2: error: #error "invalid DMA stream associated to USART3 RX"
./os/hal/ports/STM32/LLD/USARTv2/hal_uart_lld.h:478:2: error: #error "invalid DMA stream associated to USART3 TX"


this because the file /os/hal/ports/STM32/STM32F0xx/stm32_registry.h defines only DMA channels 6 and 7 available:

Code: Select all

#define STM32_USART3_RX_DMA_MSK             STM32_DMA_STREAM_ID_MSK(1, 6)
#define STM32_USART3_TX_DMA_MSK             STM32_DMA_STREAM_ID_MSK(1, 7)

which correspond only to the case when remapping bit in register SYSCFG_CFGR1 = 0 (default value).

If I modify stm32_registry.h adding the case with channels 2 and 3 like this:

Code: Select all

#define STM32_USART3_RX_DMA_MSK             STM32_DMA_STREAM_ID_MSK(1, 6) | STM32_DMA_STREAM_ID_MSK(1, 3)
#define STM32_USART3_TX_DMA_MSK             STM32_DMA_STREAM_ID_MSK(1, 7) | STM32_DMA_STREAM_ID_MSK(1, 2)

then I can compile without errors.

Then to get the USART3 (UART driver) working I need to set the remapping bit in the initial configuration:

Code: Select all

SYSCFG->CFGR1 |= SYSCFG_CFGR1_USART3_DMA_RMP;


So, my question is: is HAL supposed to support all DMA channels configuration, or supports only those channels when remapping bit = 0 (default value at reset) ?

Thanks in advance

Re: UART driver and full DMA support

Posted: Fri Sep 07, 2018 12:14 pm
by Giovanni
Hi,

It is a bug, it is supposed to list all possible DMA channels that can be used.

Moving in the bug reports forum.

Giovanni

Re: UART driver and full DMA support

Posted: Fri Sep 07, 2018 1:10 pm
by Cesare
Thank u Giovanni for yr hard work

Re: UART driver and full DMA support

Posted: Wed Sep 26, 2018 10:09 am
by Giovanni
Change committed.

Giovanni