Hello, I'm trying out ChibiOS (the latest revision from GitHub), I need to use all the available USART and UART ports of my Nucleo borad with STM32L152RE and it seems I need a little help. The microcontroller has 3 USARTS and 2 UARTS, I want USART2 as serial (for debugging) and the other 4 as U(S)ARTS:
[nfo]/*
* SERIAL driver system settings.
*/
#define STM32_SERIAL_USE_USART1 FALSE
#define STM32_SERIAL_USE_USART2 TRUE
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USART1_PRIORITY 12
#define STM32_SERIAL_USART2_PRIORITY 12
#define STM32_SERIAL_USART3_PRIORITY 12
// ...
/*
* UART driver system settings.
*/
#define STM32_UART_USE_USART1 TRUE
#define STM32_UART_USE_USART2 FALSE
#define STM32_UART_USE_USART3 TRUE
#define STM32_UART_USE_UART4 TRUE
#define STM32_UART_USE_UART5 TRUE
#define STM32_UART_USART1_IRQ_PRIORITY 10
#define STM32_UART_USART2_IRQ_PRIORITY 12
#define STM32_UART_USART3_IRQ_PRIORITY 11
#define STM32_UART_UART4_IRQ_PRIORITY 12
#define STM32_UART_UART5_IRQ_PRIORITY 12
#define STM32_UART_USART1_DMA_PRIORITY 0
#define STM32_UART_USART2_DMA_PRIORITY 0
#define STM32_UART_USART3_DMA_PRIORITY 0
#define STM32_UART_UART4_DMA_PRIORITY 0
#define STM32_UART_UART5_DMA_PRIORITY 0
#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")[/nfo]
First of all, for some reason the STM32L1 port still uses the older USAR1 library instead of USART2 (is there a good reason for this), and second of all, I am getting compilation errors:
[nfo]../chibios/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.h:230:2: error: #error "UART4 DMA access not supported in this platform"
#error "UART4 DMA access not supported in this platform"
^
../chibios/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.h:240:2: error: #error "UART5 DMA access not supported in this platform"
#error "UART5 DMA access not supported in this platform"[/nfo]
I'm positive that the microcontroller supports DMA access for both UART4 and UART5, the correct values are even defined in stm32_registry.h of the STM32L1xx port:
[nfo]#if (STM32L1XX_PROD_CAT == 1) || (STM32L1XX_PROD_CAT == 2) || \
(STM32L1XX_PROD_CAT == 3) || defined(__DOXYGEN__)
#define STM32_HAS_UART4 FALSE
#define STM32_HAS_UART5 FALSE
#else
#define STM32_HAS_UART4 TRUE
#define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
#define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
#define STM32_HAS_UART5 TRUE
#define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
#endif[/nfo]
In my case the STM32L1XX_PROD_CAT is 5, so I have both UART4 and UART5.
Can anybody help me with this, please? Thank you.
STM32L152RE UART driver problem Topic is solved
Moderator: RoccoMarco
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times
Re: STM32L152RE UART driver problem
Hello,
I will try to ans
the official repository of ChibiOS is on sourceforge and is a svn. Most likely you have downloaded a mirror. Anyway is good to know the version of HAL you are using. Take a look to \os\hal\include\hal.h
version depends on hardware not on software. There are two version of this library because there are two version of hardware implementation of this peripheral for STM32.
About this I have to take a look this weekend.
I'll keep you up to date. Ciao.
RM
I will try to ans
I'm trying out ChibiOS (the latest revision from GitHub)
the official repository of ChibiOS is on sourceforge and is a svn. Most likely you have downloaded a mirror. Anyway is good to know the version of HAL you are using. Take a look to \os\hal\include\hal.h
for some reason the STM32L1 port still uses the older USAR1 library instead of USART2
version depends on hardware not on software. There are two version of this library because there are two version of hardware implementation of this peripheral for STM32.
I'm positive that the microcontroller supports DMA access for both UART4 and UART5, the correct values are even defined in stm32_registry.h of the STM32L1xx port:
About this I have to take a look this weekend.
I'll keep you up to date. Ciao.
RM
Re: STM32L152RE UART driver problem
the official repository of ChibiOS is on sourceforge and is a svn. Most likely you have downloaded a mirror.
Yes, the repository seems to be an up-to-date mirror, I'm not familiar with SVN, sorry.
Anyway is good to know the version of HAL you are using. Take a look to \os\hal\include\hal.h
[nfo]#define HAL_VERSION "5.0.0"[/nfo]
version depends on hardware not on software. There are two version of this library because there are two version of hardware implementation of this peripheral for STM32.
Thanks for clarification.
About this I have to take a look this weekend.
I'll keep you up to date. Ciao.
Thanks again for your help, I'm attaching my current Work-in-Progress patch for adding the UART4 and UART5 support with the hope that it can save 5 minutes of your time.
- Attachments
-
- stm32l1xx-uart4-uart5.diff.gz
- (753 Bytes) Downloaded 297 times
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times
Re: STM32L152RE UART driver problem
I have just updated trunk. It compiles with UART4 and UART5 enabled. By the way if you will test the code returning a feedback it would be highly appreciated.
Re: STM32L152RE UART driver problem
Molte grazie!
Sure, I will return with a feedback on Monday or Tuesday, once I test it.
Sure, I will return with a feedback on Monday or Tuesday, once I test it.
Re: STM32L152RE UART driver problem
[nfo]#define STM32_UART5_HANDLER Vector105[/nfo]
Shouldn't this be Vector104?
Shouldn't this be Vector104?
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times