Internal reference clock trimming process for Kinetis microcontroller KE02 using programmer

cancel
Showing results for 
Search instead for 
Did you mean: 

Internal reference clock trimming process for Kinetis microcontroller KE02 using programmer

No ratings

Internal reference clock trimming process for Kinetis microcontroller KE02 using programmer

Introduction: User can modify the value of internal reference clock (IRC) by using the Trimming capability of programmers. There are two registers (ICS_C3 & ICS_C4) which contains the trim and fine trim value of the clock respectively. By default, devices comes with a factory programmed trim value which is automatically passed into these registers during reset initialization when not in debug mode. These registers needs to be passed with appropriate value to get the required clock value. This is where programmers come into picture, they generally have this capability to find the accurate trim and fine trim values corresponding to required clock. Now the catch here is that the customized trim value calculated by programmers is stored at reserved flash location (eg-0x000003ff and 0x000003fe for Ke02) and have to be copied to trim registers( ICS_C3 &C4) manually by user during code initialization. Using this process to trim the clock will give accurate desired clock without any deviation between samples.

Process: 

There is an option in programmers( like I am using PEmicro Multilink universal ) for enabling and setting the trimming feature in the configuration settings as below:

 

nxf58908_0-1609673451703.jpeg

 

 

 

After enabling this option, the programmer will find the best trim value and store at internal memory location:

 

0x03ff for trim internal reference value

0x03fe for fine trim internal reference value

 

Below snapshot from console shows this process:

 

nxf58908_1-1609673451775.jpeg

 

 

Next step is to copy these value from above locations and pass it to ICS_C3 and ICS_C4 manually in our application code. You can use below code lines:

 

    ICS->C3 = *((uint8_t*) 0x03FF); // trim internal reference clock

    ICS->C4 |= ICS_C4_SCFTRIM(*((uint8_t*) 0x03FE)); // fine trim internal reference clock

 

What the above logic does is – it copies the trimmed value from the factory programmer into your ICS register – not dependent on a constant value but dynamically update the register as per the tuning happening by the programmer.

Similar option is there in production programmers also to take care of the trimming process.

Note: Above steps are with reference to KE series, for other series user has to check the device reference manual for specific address and register.

Also attaching a code with the above mentioned things added into it for ease of understanding.

Thanks

Madhur

Attachments
Version history
Revision #:
2 of 2
Last update:
‎01-03-2021 04:53 AM
Updated by: