question about internal clock trim on kl05z32

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

question about internal clock trim on kl05z32

1,690 次查看
wangbaode
Contributor IV

I want to trim internal clock of KL05Z32.In reference document,I find AutoTrim machine.

my question is as follow:

1,is it right that the module must need a external clock? if  there is on external clock in my board,can I trim internal clock?

2,How to trim the internal clock in freescale factory?

3,in reference,cpu will copy some value in flash to register.

But I create a new project.and i debug it with codewarrior10.3.I find 0x3fe-0x3ff is filled with 0xff.but MCGC3,MCG_C3 and  MCG_C4(bit5:0) is not 0xff.Why?

 

6071_6071.pngpastedImage_39.png

 

6072_6072.pngpastedImage_46.png

 

4, will the trim value in flash  be erased when I program my new program?

Original Attachment has been moved to: KL05Z32_ADDRESS.rar

标记 (5)
0 项奖励
回复
4 回复数

715 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Baode,

1> If you don't use external debugger tool to do trim work, then you need the external clock to generate trim reference clock. The auto trim reference clock is bus clock, which need be 8-16MHz.

You could refer below link, how to use P&E Multilink tool to trim the internal clock:

https://community.freescale.com/docs/DOC-95356

2> The internal reference clock had been trimmed before ship to ended customer. The factory trim processor is Freescale property, could not be disclosed.

3> Below code will realize copy trim value to trim register:

if ( *((uint8_t*) 0x03FFU) != 0xFFU) {

    MCG_C3 = *((uint8_t*) 0x03FFU);

    MCG_C4 = (MCG_C4 & 0xFEU) | ((*((uint8_t*) 0x03FEU)) & 0x01U);

  }

4> If Flash was erased with trim value stored Flash sector, the trim value was erased.

Wish it helps.

B.R.

Ma Hui

0 项奖励
回复

715 次查看
wangbaode
Contributor IV

Hi Ma Hui,

Thanks for your answer which resolves most of my questions.But the first question still confuses me.

pastedImage_0.png

the screenshot is from reference of kl05z32.

There is a Auto trim machine that can trim internal clock.input clcok of the module is external clock and not bus clock.

So,how can we use bus clock to trim internal clock? is it right that debugger tool use Auto trim machine to trim internal clock?

0 项奖励
回复

715 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Baode,

There with description about MCG ATM reference clock source in RM:

The ATM machine uses the bus clock as the external reference clock to perform the IRC auto-trim. Therefore, it is required that the MCG is configured in a clock mode where the reference clock used to generate the system clock is the external reference clock such as

FBE clock mode. The MCG must not be configured in a clock mode where selected IRC ATM clock is used to generate the system clock. The bus clock is also required to be running with in the range of 8–16 MHz.

The bus clock could be external oscillator reference clock directly (FBE or PBE mode).

About how debugger tool to do auto trim, which is debugger tool company property, we have no more info about it.

Customer can use MCG ATM to trim internal clock with bus clock.

Wish it helps.

0 项奖励
回复

715 次查看
wangbaode
Contributor IV

Hi  Ma,

Thanks. I see you.

best regards

0 项奖励
回复