Question
STM32L0 UART HAL driver issue
Posted on November 11, 2015 at 22:11
Hi,
I have spotted a potential bug in the HAL driver for the UART on (at least) the STM32L0. The macro for determining the BRR register value__DIV_LPUART is defined as follows:#define __DIV_LPUART(_PCLK_, _BAUD_) (((_PCLK_)*256)/((_BAUD_)))
Any value passed to this macro for the _PCLK_ token over 16MHz will result in overflow as it is multiplied by 256 before being divided by the required _BAUD_.
I noticed this as I tried to use the HAL driver to set my PCLK driven UART (32MHz) to 9600 and saw it come out as 19
Has this been raised before? Note: this is with the latest IAR compiler for ARM (7.1)
#hal #uart #cubemx #stm32l0