STM32 USART v.2 Serial Driver Reinit error Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
alexblack
Posts: 276
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 32 times
Contact:

STM32 USART v.2 Serial Driver Reinit error  Topic is solved

Postby alexblack » Mon Jan 31, 2022 12:53 am

Hi.
In stable branch 21.11.x and 21.6.x (and maybe in earler) reconfiguration the baudrate scenario is broken because in function serial_lld_start is called the function usart_init with variable clock which is not setted when serial driver already is in READY state:

Code: Select all

 \stable_21.11.x\os\hal\ports\STM32\LLD\USARTv2\hal_serial_lld.c
694 /**
965  * @brief   Low level serial driver configuration and (re)start.
996  *
697  * @param[in] sdp       pointer to a @p SerialDriver object
698  * @param[in] config    the architecture-dependent serial driver configuration.
699  *                      If this parameter is set to @p NULL then a default
700  *                      configuration is used.
701  *
702  * @notapi
703  */
704 void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
705   uint32_t clock = 0U;
706
707   if (config == NULL)
708     config = &default_config;
709
710   if (sdp->state == SD_STOP) {
711 #if STM32_SERIAL_USE_USART1
712     if (&SD1 == sdp) {
713       clock = STM32_USART1CLK;
714       rccEnableUSART1(true);
715     }
716 #endif
...
765   }
766   usart_init(sdp, config, clock);
767 }

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

Re: STM32 USART v.2 Serial Driver Reinit error

Postby Giovanni » Mon Jan 31, 2022 11:16 am

Hi,

Thanks for finding, it affects Serial, SIO and UART in both USARTv2 and USARTv3. USARTv1 is fine.

Giovanni

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

Re: STM32 USART v.2 Serial Driver Reinit error

Postby Giovanni » Mon Jan 31, 2022 12:08 pm

Fixed as bug #1217.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 9 guests