LPUART XTAL frdm KL03z

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPUART XTAL frdm KL03z

跳至解决方案
499 次查看
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

标签 (1)
标记 (3)
0 项奖励
1 解答
428 次查看
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

在原帖中查看解决方案

1 回复
429 次查看
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