Clock Settings of MC9S12ZVMC128 for 100 MHZ

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

Clock Settings of MC9S12ZVMC128 for 100 MHZ

410 Views
gayatrimeti
Contributor I

Hi

 

Im working on the S912ZVMC12F1WKH "MAGNIV" Target microcontroller on the ECU and Im facing an issue of Exception(Control does not jump to startup after code flash and resets) while setting the PLL for 100 MHZ using the Crystal clock frequency 16MHZ. I have tried with the following settings as mentioned below:

 

CPMUCOP_REG = CPMUCOP_DISABLE_MASK;     /* Disable the MCU COP */

IVBR_REG = 0xFFFEU;                    /* Interrupt Vector Base */

  ECLKCTL = 0x80U;                        /* Set the NECLK = 1  in ECLK control register*/

  CPMUPROT = 0x26;                      /* Unprotect the Clock Setting registers*/

  CPMUCLKS = 0x40U;                  /* To enter into the Pseudo-Stop mode PSTP =1*/

  CPMUCLKS = 0x80U;                  /* To set the PLLSEL =1, for selection of PLL */

  POSTDIV = 0x00U;                      /* set the Postdiv to 0fpll = 100MHZ, */

  CPMUSYNR = 0x00U;                

  CPMUREFDIV = 0x07;                  /*To get the Fref = 2MHZ */

  CPMUOSC2 = 0x02U;                  /* To enable the Oscillator monitor reset*/

  CPMUOSC = 0x80U;                    /* To enable the Oscillator */

  CPMUPLL = 0x00U;                     /* frequency modulation = 00*/

  CPMUSYNR = 0xD8;                   /* SYNR = 24U, VCO frequency range in between 80 to 100 MHZ, VCOFREQ = 11 */

  while(CPMUIFLG_UPOSC == 0U) { 

  }

  CPMUPROT = 0x00;                

 

Please verify the code snippet and let me know why do I get an Exception after flashing the code asap.

 

Thanks & Regards

Gayatri

Labels (1)
0 Kudos
1 Reply

253 Views
RadekS
NXP Employee
NXP Employee

Hi Gayatri,

I tested your code and it works on my S12ZVML12EVB board.

My modifications:

1.    I commented out these lines (non-default definitions, without connection to PLL):

CPMUCOP_REG = CPMUCOP_DISABLE_MASK;    /* Disable the MCU COP */

IVBR_REG = 0xFFFEU;                    /* Interrupt Vector Base */

And renamed “POSTDIV” to default “CPMUPOSTDIV”

2.    And clear NECLK bit in ECLKCTL register to see bus clock on PP0 pin (I have also disconnectd jumper from J14 connector).

ECLKCTL = 0x80U;

3.    Since EVB oscillator has just 4MHz, I modified CPMUREFDIV to 0x01:

CPMUREFDIV = 0x01;                  /*To get the Fref = 2MHZ */

The code works correctly in CW with my USB Multilink rev.C (USB-ML-12E) and Win7 x64 OS.

When I tested on board OSBDM interface, debugger got lost at command CPMUSYNR = 0xD8;.

It seems that 50MHz is beyond a limit of OSBDM interface.

If you use OSBDM interface, please go to Debug Configuration and Edit target settings:

Edit Debug Configuration CW10.png

And uncheck “Use Bus Clock as Debug Controller (SIBDC) Clock Source {Default=Checked}”.

Do not use bus clock for debug CW10.png

With that modification, you should be able to debug S12ZVM at 50MHz bus clock.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos