mc9s12xeq512 mcu & flash initialiation

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

mc9s12xeq512 mcu & flash initialiation

Jump to solution
664 Views
Eric_t
Contributor III

Hi!

 

I have download from NXP demo example project for programming the internal flash memory of XEP controllers.

The project that I download is "XEP100-FLASH-PFLASH-CW51"

The project works just fine, but the problem that I am facing, is that it is not clear what is the correct frequency that I should enter in PFLASH_Init routine.

 

"PFLASH_Init routine"

//==============================================================================
//PFLASH_Init
//==============================================================================
void PFLASH_Init(unsigned char fdiv)
{
while(FSTAT_CCIF == 0); //wait if command in progress
FCLKDIV = fdiv; //osc = 16MHz
}

the main calls it as follow

 

  PFLASH_Init(0x0F);//oscillator 16MHz

 

 

So, it gives 0x15 for 16MHz oscillation. 

I will use the PLL with High speed (internal bus clock 50MHz), Low speed (internal bus clock 14.75MHz), Slow speed (internal bus clock 4MHz).

The problem is that PFLASH_Init has no comments about the formula of oscillation and the operant of "PFLASH_Init routine"

 

Could someone from NXP tell me how can I calculate the operant of "PFLASH_Init routine" when the internal bus clockis 50, 14.75 and 4MHz?

 

Thank you

Original Attachment has been moved to: XEP100-FLASH-PFLASH-CW51.ZIP

0 Kudos
1 Solution
484 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

yes, the value 0x0F because the flash clock is derived from oscillator clock. The only what is different is PLL setup for BUSCLK.

Ups, I have forgotten. the data sheet also presents:

pastedImage_1.png

Best regards,

Ladislav

View solution in original post

0 Kudos
3 Replies
485 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

yes, the value 0x0F because the flash clock is derived from oscillator clock. The only what is different is PLL setup for BUSCLK.

Ups, I have forgotten. the data sheet also presents:

pastedImage_1.png

Best regards,

Ladislav

0 Kudos
483 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

please go to our pages and you can find there calculator at the page:

S12XE MCUs|16-Bit Microcontroller|NXP 

pastedImage_1.png

Or directly:

https://www.nxp.com/downloads/en/calculators/S12XESW.zip 

The answer is:

pastedImage_3.png pastedImage_4.png pastedImage_5.png

Best regards,

Ladislav

0 Kudos
484 Views
Eric_t
Contributor III

Hi lama,

Thank you for the quick answer.

As far as I understand, the FCLKDIV   of "PFlash_Ini" routine, is the "FDIV" of S12XEiPLL calculator, and in all cases it should be 0x0F.

Is that correct?

Thank you.

0 Kudos