USARTv1 regression on STM32F1xx.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13898 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2020-11-08 08:46:17 +00:00
parent 417d450e0b
commit 7064624f81
1 changed files with 2 additions and 0 deletions

View File

@ -114,11 +114,13 @@ static void usart_init(SerialDriver *sdp, const SerialConfig *config) {
brr = (uint32_t)(sdp->clock / config->speed);
#if defined(USART_CR1_OVER8)
/* Correcting BRR value when oversampling by 8 instead of 16.
Fraction is still 4 bits wide, but only lower 3 bits used.
Mantissa is doubled, but Fraction is left the same.*/
if (config->cr1 & USART_CR1_OVER8)
brr = ((brr & ~7) * 2) | (brr & 7);
#endif
osalDbgAssert(brr < 0x10000, "invalid BRR value");