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
Solved! Go to Solution.
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:
Best regards,
Ladislav
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:
Best regards,
Ladislav
Hi,
please go to our pages and you can find there calculator at the page:
S12XE MCUs|16-Bit Microcontroller|NXP
Or directly:
https://www.nxp.com/downloads/en/calculators/S12XESW.zip
The answer is:
Best regards,
Ladislav
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.