LPUART XTAL frdm KL03z

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

LPUART XTAL frdm KL03z

Jump to solution
497 Views
ramonramirez
Contributor II

I am working with the frdmKL03Z and the example lpuart_polling in the SDK 2.2 in that example use the internal oscilator but i need more Precision in the count of time

add a xtal but i think i need make changes in the software to the LPUART works well

someone can tell me if i am right ?

what change needed?

best regards

Labels (1)
0 Kudos
1 Solution
426 Views
mjbcswitzerland
Specialist V

Hi Ramon

To clock the KL03 LPUART from the XTAL you need to set

SIM_SOPT2 |= (SIM_SOPT2_UART0SRC_OSCERCLK);

so that the OSCERCLK is connected to it.

Before that, you also need to enable the oscillator:

OSC0_CR = (OSC_CR_ERCLKEN | OSC_CR_EREFSTEN);   // enable the oscillator and allow it to continue oscillating in stop mode

The crystal will need to have a frequency that is suitable for the Baud rate generation - eg, the 32kHz on the FRDM-KL03Z is not because it is too slow.

Regards

Mark

http://www.utasker.com/kinetis/FRDM-KL03Z.html

View solution in original post

1 Reply
427 Views
mjbcswitzerland
Specialist V

Hi Ramon

To clock the KL03 LPUART from the XTAL you need to set

SIM_SOPT2 |= (SIM_SOPT2_UART0SRC_OSCERCLK);

so that the OSCERCLK is connected to it.

Before that, you also need to enable the oscillator:

OSC0_CR = (OSC_CR_ERCLKEN | OSC_CR_EREFSTEN);   // enable the oscillator and allow it to continue oscillating in stop mode

The crystal will need to have a frequency that is suitable for the Baud rate generation - eg, the 32kHz on the FRDM-KL03Z is not because it is too slow.

Regards

Mark

http://www.utasker.com/kinetis/FRDM-KL03Z.html