[LPC]: Regarding to Internal Clock Calibration

cancel
Showing results for 
Search instead for 
Did you mean: 

[LPC]: Regarding to Internal Clock Calibration

No ratings

[LPC]: Regarding to Internal Clock Calibration

LPC: Regarding to Internal Clock Calibration

In MCU development, using the internal crystal oscillator as a clock source instead of the external crystal oscillator can save costs. But the clock frequency generated by the internal crystal oscillator is affected by temperature and MCU frequency more than external crystal oscillator. Many customers have questions about the internal clock accuracy, whether the internal clock can be used for USB transmission, and how to calibrate the internal clock. This article mainly explains this.

1. Calibrate internal clock by FREQTRIM

Normally, we can only calibrate the internal clock by adjusting the FREQTRIM value.

The internal clock frequency is affected by temperature, MCU frequency and other factors. The FRO control register can calibrate the internal clock, as follows:

ZhangJennie_0-1628843809244.png

 

The FREQTRIM register value ranges from 0 to 255, and each adjustment step is about 0.1% of the internal clock frequency. There is no precise formula to express the relationship between the FREQTRIM value and the FRO frequency. The ideal FREQTRIM value can only be determined by adjusting FREQTRIM in code and observing FRO output waveform with oscilloscope.

Test and observation:

The following is the test result. It shows how FRO frequency varies with FREQTRIM increasing from 0-255.

Test result of first development board:

ZhangJennie_1-1628843899675.png
 
 

Test result of second development board:

ZhangJennie_2-1628843916888.png

 

The following two points can be seen from test results:

- There is no linear relationship between the FRO clock frequency and the FREQTRIM register value, and there is no precise formula to express the relationship between them;

- Even for chips of the same part number, the internal clock frequency changes are slightly different, with the FREQTRIM register value changing, but the trend is same.

Therefore, there is no precise formula to guide internal clock frequency calibration. You can only adjust the FREQTRIM register value repeatedly, just like adjusting the focus of a projector. Use an oscilloscope to check the frequency of the internal clock pin to find the most suitable FREQTRIM register value.

There is same solution for FRO clock frequency calibration about other LPC chips.

 

2. LPC51U68: Software calibration USB transmission when using internal clock source

The Full Speed USB module of LPC51U68 has a unique FRO automatic calibration function, which automatically adjusts the FREQTRIM value to achieve FRO calibration by measuring the USB SOF bit. Once FRO is calibrated, the corresponding system clock and peripheral clock are calibrated. This solution is only applicable to LPC51U68, please refer to the user manual for other chips.

The following is the FRO clock accuracy described in LPC51U68 User Manual, which is ±1%:

ZhangJennie_3-1628843942440.png

 

For Full Speed USB, the USB data transmission accuracy requirement is ±0.25%, and the FRO clock accuracy is not satisfied. NXP provides a software solution to calibrate FRO by measuring the first packet of frame (SOF), which can meet the transmission accuracy in Full Speed mode.

ZhangJennie_4-1628843964441.png

 

The solution download link is as follows:

https://www.nxp.com/docs/en/application-note/TN00035.zip

 

Version history
Revision #:
2 of 2
Last update:
‎08-13-2021 01:45 AM
Updated by: