KL17 LPUART noise error with 4 Mhz external crystal

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KL17 LPUART noise error with 4 Mhz external crystal

394 Views
christopherport
Contributor I

I had a board with a 48 Mhz crystal and had the LPUART module communicating at 115200 baud with no errors.  Then I swapped out the external clock for one at 4 MHz and the receiver stopped working (the transmitter is still working fine). Communication works if I reduce the baud rate to 9600.  I have verified the following are within tolerance:

!.  External clock speeds;  with scope and also by toggling GPIO with interrupt driven timer.

2. Bit width of data on TX and RX lines

3. Error flags in the LPUART ISR.  We are getting noise error which may suggest phase shifting error.

4. Computation of OSR and SBR.  Baud clock should be 114285 Hz.

Below is the code used to set up the UART

SIM->SOPT5 = ((SIM->SOPT5 &
(~(SIM_SOPT5_LPUART0TXSRC_MASK | SIM_SOPT5_LPUART0RXSRC_MASK)))
| SIM_SOPT5_LPUART0TXSRC(sopt5LPUART0TxSrc)
| SIM_SOPT5_LPUART0RXSRC(sopt5LPUART0RxSrc)
);

CLOCK_SetLpuart0Clock(2);

lpuart_config_t lpuart_config;
LPUART_GetDefaultConfig(&lpuart_config);
lpuart_config.baudRate_Bps = 115200;
lpuart_config.enableRx = true;
lpuart_config.enableTx = true;

LPUART_Init(LPUART0, &lpuart_config, CLOCK_GetFreq(kCLOCK_Osc0ErClk));

LPUART_EnableRx(LPUART0, true);
LPUART_EnableTx(LPUART0, true);
LPUART_EnableInterrupts(LPUART0, kLPUART_RxDataRegFullInterruptEnable);
LPUART_EnableInterrupts(LPUART0, kLPUART_NoiseErrorInterruptEnable | kLPUART_FramingErrorInterruptEnable | kLPUART_RxOverrunInterruptEnable);
EnableIRQ(LPUART0_IRQn);

Thank you

0 Kudos
1 Reply

284 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Christopher Porter,

    114285 still meet the 115200 bps 1.5% allowed error, it should work.

    Please tell me the full name of your KL17, the part number.

    Please also tell me your core clock and the bus clock.

   Then, you can send me the test project, I will help you to check it on my side.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos