HCS12, S12X programming speed.

Showing results for 
Search instead for 
Did you mean: 

HCS12, S12X programming speed.

Contributor III

I am using mc9s12xdt512 and mc9sxeq512 controllers.

All of them have 16MHz crystal and xdt512 has PLL filter for 40MHz bus frequency
Compiler, codewarrior 5.2
Debugger, multilink universal and multilink FX.

Windows 10 PC.

I have an issue with the programming speed.


For mc9s12xdt512:
The programming speed with 16MHz crystal is 16KB per second.
I have replaced crystal with 29MHz and the programming speed increased from 16KB per second to 21KB per second.
So it seems, the internal bus frequency specifies the programming speed.
Does anyone know, if there is there is a way to activate the PLL during programming, so I can have crystal 16MHz, 40MHz bus frequency, and better programming speed? 


For mc9sxeq512.
The programming speed with 16MHz crystal is only 9KB per second.

The programming time of the whole 512KB of firmware, takes ages, making debugging a very painful procedure.
Does anyone if there is a way to improve the programming speed.

Thank you

3 Replies

NXP TechSupport
NXP TechSupport

Hi  Eric_t d,

I'm not sure from your question if you already configured the PLL filter. If yes, could you send me the code with your settings?

If not, for the configuration PLL, I recommend you PLL calculator S12X PLL (Filter) Calculator  

There you can choose oscillator and BUS clock frequency and calculate the setting of the registers and set it in the PLL_Init function below.

Below you can see example code for the PLL settings of the S12XEP100 MCU, you can use it for the S12XEQ512 and you can be inspired which registers you should set for the S12XDT512.  

void PLL_Init(unsigned char synr, unsigned char refdv, unsigned char postdi) {

  PLLCTL = 0B00000001; // CME=0,PLLON=0,FM1=0,FM2=0,FSTWKP=0,PRE=0,PCE=0,SCME=1


  SYNR = synr;         // Set the multiplier register

  REFDV = refdv;       // Set the divider register

  POSTDIV = postdiv;   // Set the post divider register

  PLLCTL_PLLON = 1;    // Enable the Phase Lock Loop 

  while(!CLKSEL_PLLSEL)  // PLLSEL=1 check

  { while(!CRGFLG_LOCK); // Wait till the PLL VCO is within tolerance

    CLKSEL_PLLSEL = 1;   // Select clock source from PLLCLK



void main(void) { 

  PLL_Init(0xC4,0x83,0x00); // 50MHz BUSCLK from 40MHz OSCCLK


  for(;;) {} /* wait forever */

  /* please make sure that you never leave this function */


I hope it helps you.

Best regards,


Contributor III

Hi Batrova.

Sorry for the misunderstanding.

By "programming speed" I mean the time that needs codewarrior to programm the firmware to controller.

The picture below, shows the programming speeds.


As you can see, for mc9s12xdt512 with crystal 16MHz, the programming speed is 16kB per second, while with crystal 29MHz is 21kB per second.

For mc9s12xeq512, it is even worst. The programming speed with crystal 16MHz is only 10kB per second.

The problem is that for large firmwares (almost 512kB), the programming time is way too long and slows down the debugging procedure.

Especially for mc9s12xeq512, the programming time is unacceptable long.

I suppose that there is way to speed up the programming procedure. 

As far as I understand, during programming procedure, the PLL is OFF and this is the reason of the slow programming times.  

I have made some measures with the following pemicro algorithms for cyclon pro.

-   Freescale_9S12XDP512_1x16x256k_512k_Linear_16k_page.12P

-   Freescale_9S12XDP512_1x16x256k_512k_Linear_16k_page_pll.12P

The algorithm with the PLL, activates the PLL and gives 25MHz bus frequency, reducing the programming time by 20 seconds.

So, my question is, if there is a way to tell codewarrior to activate the PLL when programming the firmware in order to reduce the programming time?

Or is there any other way the reduce programming speed?

0 Kudos

Contributor I

the programming speed is decided by the crystal,not the pll.

0 Kudos