UART driver and full DMA support Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
Cesare
Posts: 20
Joined: Tue Jul 11, 2017 11:51 am
Location: Milan, Italy
Been thanked: 2 times

UART driver and full DMA support  Topic is solved

Postby Cesare » Fri Sep 07, 2018 9:01 am

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: 11307
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 412 times
Been thanked: 342 times
Contact:

Re: UART driver and full DMA support

Postby Giovanni » Fri Sep 07, 2018 12:14 pm

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: 20
Joined: Tue Jul 11, 2017 11:51 am
Location: Milan, Italy
Been thanked: 2 times

Re: UART driver and full DMA support

Postby Cesare » Fri Sep 07, 2018 1:10 pm

Thank u Giovanni for yr hard work

User avatar
Giovanni
Site Admin
Posts: 11307
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 412 times
Been thanked: 342 times
Contact:

Re: UART driver and full DMA support

Postby Giovanni » Wed Sep 26, 2018 10:09 am

Change committed.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest