UART driver and full DMA support Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
User avatar
Cesare
Posts: 38
Joined: Tue Jul 11, 2017 11:51 am
Has thanked: 4 times
Been thanked: 4 times

UART driver and full DMA support

Post 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
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: UART driver and full DMA support

Post 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
User avatar
Cesare
Posts: 38
Joined: Tue Jul 11, 2017 11:51 am
Has thanked: 4 times
Been thanked: 4 times

Re: UART driver and full DMA support

Post by Cesare »

Thank u Giovanni for yr hard work
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: UART driver and full DMA support

Post by Giovanni »

Change committed.

Giovanni
Post Reply