# KL82 LPUART0 Baud Half What Expected Based On Theory

Question asked by Andrew Pikul on Sep 11, 2017
Latest reply on Sep 12, 2017 by Jing Pan

Here's my initialization code:

``#define _B(x) (1<<x)void uart_init(){   SIM_SOPT2 |= (_B(26) ); // Set lpuart clk to SOPT2[PLLFLLSEL]    SIM_SOPT2 |= (_B(16) | _B(17)); // set PLLFLLSEL to IR48    SIM_SCGC5 |= _B(20); // turn on gate for lpuart     SIM_SCGC5 |= _B(9); // turn on port a    PORTA_PCR14 = (_B(8) | _B(9) ); // set pin to UART    PORTA_PCR15 = (_B(8) | _B(9) ); // set pin to UART //   LPUART0_BAUD |= _B(17); // more accurate baud    LPUART0_BAUD &= ~_B(2); // 0 default value there    LPUART0_BAUD |= 13; // why isn't this 26?    LPUART0_CTRL |= ( _B(23) | _B(22) | _B(21) ); // turn on interrupts    LPUART0_FIFO |= (_B(7) | _B(3) | _B(10) | _B(11) ); // turn on the fifo and throw a read interupt if idle for 4    characters    LPUART0_WATER |= (5<<16) | 2; // buffers are eight bytes, do everything in chunks of five (notify RX if < 5    //in buffer, send 5 if > 2 in buffer)    LPUART0_CTRL |= ( _B(19) | _B(18) ); // up and away!}``

My issue is with line 11. I'm expecting by the equation to write 26 there.

Clock / ((OSR+1) * SBR )

48Mhz / (( 15  +1) *  26  )

I figured the 48Mhz was getting halved somewhere but all the divider ratios are left @ default etc. Not quite sure what to make it. It works @ `SBR = 13` well <1% of 115200 but it's bothering me