Obtain trim value to 9S08PT60 microcontroller

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

Obtain trim value to 9S08PT60 microcontroller

765 Views
Eneko
Contributor II

Hello:

 

I´m working with new micro 9S08PT69 and I am trying to configure internal clock to obtain a ICSLCK signal of 10Mhz. To do that, I must configure FEI internal clock to 20MHz and there is this example on manual:

ICS_C2 = 0x00;

ICS_C1 = 0x04; // Internal refrence clock to FLL

ICS_C3 = 0x00; // I think here manual is wrong, this must be ICS_C2 = 0x00;

ICS_C3 = TRIM_VALUE_39K0625Hz // FLL clock to 20Mhz

 

My question is; Where does this TRIM_VALUE_39K0625Hz come from? I have seen in file 9s08pt60.s8p which is into my CW MCU v10.2 that exist this option: 09BIT_TRIM=303A/303B/01/FF6F/FF6E/000F4240/

Here, there is 2 bytes and ICS_C3 is only one.

 

Must I load the value located in FF6E address into ICS_C3 (8 bits)  and the value of  FF6F into ICS_C4_SCFTRIM (1 bit) ? II´ve tried to do that and my programn doesnt work propertly.

 

Let me know.

 

best regards

 

Eneko

Labels (1)
0 Kudos
3 Replies

404 Views
admin
Specialist II

I am trying to trim the Internal Oscilator of the MC9S08PT32 but I can not find the values of for trimming it. I also looked into the reference manual and in the example it has a value of TRIM_VALUE_39K0625Hz... could anyone post the corresponding values for trimming the internal oscilator?

0 Kudos

404 Views
deepakrana
NXP Employee
NXP Employee

Hi

You generate a PE code for the device and in the that you will find the location defined for trimming.

In cpu.c

if (*(uint8_t*)0xFF6FU != 0xFFU) {   /* Test if the device trim value is stored on the specified address */

    ICS_C3 = *(uint8_t*)0xFF6FU;       /* Initialize ICS_C3 register from a non volatile memory */

    ICS_C4 = (uint8_t)((*(uint8_t*)0xFF6EU) & (uint8_t)0x01U); /* Initialize ICS_C4 register from a non volatile memory */

  }

When you program in the debug configurations you go to advanced programming options. In this you will find the option to enable trimming of the oscillator.  You enter the frequency to which you want the oscillator to be trimmed to.

Check this link for the steps: Trimming S08 with P&E | MCU on Eclipse

The PE mult link  will trim the internal RC to the value you have programmed,

In the debug mode you can go to the Non volatile locations of the flash (corresponding to ICS TRIM ) to check for the value programmed.

Hope this helps.

cheers

0 Kudos

404 Views
fferraro
Contributor II

I found that in BDM mode is necessary to copy:

0xFF6F in to 0x303A and bit 0 of 0xFF6E in to 0x303B.

In normal mode (see page 217 of the reference manual) it is loaded automatically at reset.

In this way it works,  but I didn’t found it in the manuals.