niekiran / MasteringMCU

Udemy Mastering Microcontroller Course Repository
399 stars 380 forks source link

USART BRR DIV_Fraction[3:0] should have 4 bits #11

Closed panoskalf closed 2 years ago

panoskalf commented 2 years ago

https://github.com/niekiran/MasteringMCU/blob/2742e0297de67851bda72892beed23cd800d1615/Resources/Source_code/Workspace/stm32f4xx_drivers/drivers/src/stm32f407xx_usart_driver.c#L66

Shouldn't this actually be: F_part = ((( F_part * 8)+ 50) / 100)& ((uint8_t)0x0F);

Because BRR register DIV_Fraction[3:0] always has 4 bits.

panoskalf commented 2 years ago

image