1192: stm32/usart: implement stop_bits configuration r=Dirbaio a=pattop 1193: stm32/usart: fix LPUART clock multiplier r=Dirbaio a=pattop According to RM0351 Rev 9 (L4) and RM0399 Rev 3 (H7): baud = (256 * clock) / LPUARTDIV Co-authored-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
This commit is contained in:
		
						commit
						c8a7b74bc2
					
				@ -770,7 +770,14 @@ fn configure(r: Regs, config: &Config, pclk_freq: Hertz, multiplier: u32, enable
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    unsafe {
 | 
					    unsafe {
 | 
				
			||||||
        r.brr().write_value(regs::Brr(div));
 | 
					        r.brr().write_value(regs::Brr(div));
 | 
				
			||||||
        r.cr2().write(|_w| {});
 | 
					        r.cr2().write(|w| {
 | 
				
			||||||
 | 
					            w.set_stop(match config.stop_bits {
 | 
				
			||||||
 | 
					                StopBits::STOP0P5 => vals::Stop::STOP0P5,
 | 
				
			||||||
 | 
					                StopBits::STOP1 => vals::Stop::STOP1,
 | 
				
			||||||
 | 
					                StopBits::STOP1P5 => vals::Stop::STOP1P5,
 | 
				
			||||||
 | 
					                StopBits::STOP2 => vals::Stop::STOP2,
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
        r.cr1().write(|w| {
 | 
					        r.cr1().write(|w| {
 | 
				
			||||||
            // enable uart
 | 
					            // enable uart
 | 
				
			||||||
            w.set_ue(true);
 | 
					            w.set_ue(true);
 | 
				
			||||||
@ -1148,7 +1155,7 @@ macro_rules! impl_lpuart {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
foreach_interrupt!(
 | 
					foreach_interrupt!(
 | 
				
			||||||
    ($inst:ident, lpuart, $block:ident, $signal_name:ident, $irq:ident) => {
 | 
					    ($inst:ident, lpuart, $block:ident, $signal_name:ident, $irq:ident) => {
 | 
				
			||||||
        impl_lpuart!($inst, $irq, 255);
 | 
					        impl_lpuart!($inst, $irq, 256);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ($inst:ident, usart, $block:ident, $signal_name:ident, $irq:ident) => {
 | 
					    ($inst:ident, usart, $block:ident, $signal_name:ident, $irq:ident) => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user