Incorrect SerialDriver instance use for UART9 init in USARTv3/hal_serial_lld.c Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
ych
Posts: 45
Joined: Tue Mar 03, 2015 11:38 pm
Has thanked: 17 times
Been thanked: 11 times

Incorrect SerialDriver instance use for UART9 init in USARTv3/hal_serial_lld.c

Post by ych »

It seems copy-paste typo in UART9 init section where SD8 used instead of SD9:

Code: Select all

diff --git a/os/hal/ports/STM32/LLD/USARTv3/hal_serial_lld.c b/os/hal/ports/STM32/LLD/USARTv3/hal_serial_lld.c
index fca0443cf..984621a4f 100644
--- a/os/hal/ports/STM32/LLD/USARTv3/hal_serial_lld.c
+++ b/os/hal/ports/STM32/LLD/USARTv3/hal_serial_lld.c
@@ -773,10 +773,10 @@ void sd_lld_init(void) {
 
 #if STM32_SERIAL_USE_UART9
   sdObjectInit(&SD9);
-  iqObjectInit(&SD9.iqueue, sd_in_buf9, sizeof sd_in_buf9, NULL, &SD8);
-  oqObjectInit(&SD9.oqueue, sd_out_buf9, sizeof sd_out_buf9, notify9, &SD8);
-  SD8.usart = UART9;
-  SD8.clock = STM32_UART9CLK;
+  iqObjectInit(&SD9.iqueue, sd_in_buf9, sizeof sd_in_buf9, NULL, &SD9);
+  oqObjectInit(&SD9.oqueue, sd_out_buf9, sizeof sd_out_buf9, notify9, &SD9);
+  SD9.usart = UART9;
+  SD9.clock = STM32_UART9CLK;
 #if !defined(STM32_UART9_SUPPRESS_ISR) && defined(STM32_UART9_NUMBER)
   nvicEnableVector(STM32_UART9_NUMBER, STM32_SERIAL_UART9_PRIORITY);
 #endif
ych
Posts: 45
Joined: Tue Mar 03, 2015 11:38 pm
Has thanked: 17 times
Been thanked: 11 times

Re: Incorrect SerialDriver instance use for UART9 init in USARTv3/hal_serial_lld.c

Post by ych »

It will be great if this fix could be applied to the stable_21.11.x branch.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Incorrect SerialDriver instance use for UART9 init in USARTv3/hal_serial_lld.c

Post by Giovanni »

Hi,

Fixed in trunk and stable.

Giovanni
anotheruserofchibios
Posts: 7
Joined: Wed Aug 24, 2022 3:52 pm
Been thanked: 6 times

Re: Incorrect SerialDriver instance use for UART9 init in USARTv3/hal_serial_lld.c

Post by anotheruserofchibios »

Hi, it looks like you missed SD8 on lines 778 and 779. ;)
Post Reply