i am currently using the TRK S12ZVH128 evolution board for pre-development.
I am trying to set the CPU Bus frequency up to 32Mhz (Max frequency).
Unfortunately the code always crashes when I try to set the CPMUSYNR register.
To eliminate bugs on my code i also tried to generate the CPU init code with processor expert, but it still crashes.
When i reduce the frequency down to 26 Mhz the initialization seems to work.
As i told, we are using the S12ZVH128 for pre-developing. For the product itself a S12zVH64 is planned.
If i run the code with the S12zVH64 it seems to work correctly. Why can't i use the maximum frequency for the S12ZVH128 and is it a problem to use 32Mhz for the S12zVH64?
/*** !!! Here you can place your own code using property "User code before PE initialization" on the build options tab of the CPU compoennt. !!! ***/
/* ### MC9S12ZVH128_144 "Cpu" init code ... */
/* PE initialization code after reset */
/* IVBR: IVB_ADDR=0x7FFF,??=0 */
/* ECLKCTL: NECLK=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
/* System clock initialization */
/* CPMUPROT: ??=0,??=0,??=1,??=0,??=0,??=1,??=1,PROT=0 */
setReg8(CPMUPROT, 0x26U); /* Disable protection of clock configuration registers */
/* CPMUCLKS: PSTP=0 */
/* CPMUCLKS: PLLSEL=1 */
setReg8Bits(CPMUCLKS, 0x80U); /* Enable the PLL to allow write to divider registers */
/* CPMUPOSTDIV: ??=0,??=0,??=0,POSTDIV4=0,POSTDIV3=0,POSTDIV2=0,POSTDIV1=0,POSTDIV0=0 */
setReg8(CPMUPOSTDIV, 0x00U); /* Set the post divider register */
/* Whenever changing PLL reference clock (REFCLK) frequency to a higher value
it is recommended to write CPMUSYNR = 0x00 in order to stay within specified
maximum frequency of the MCU */
/* CPMUSYNR: VCOFRQ1=0,VCOFRQ0=0,SYNDIV5=0,SYNDIV4=0,SYNDIV3=0,SYNDIV2=0,SYNDIV1=0,SYNDIV0=0 */
setReg8(CPMUSYNR, 0x00U); /* Set the multiplier register */
/* CPMUPLL: ??=0,??=0,FM1=0,FM0=0,??=0,??=0,??=0,??=0 */
setReg8(CPMUPLL, 0x00U); /* Set the PLL frequency modulation */
/* CPMUSYNR: VCOFRQ1=0,VCOFRQ0=1,SYNDIV5=0,SYNDIV4=1,SYNDIV3=1,SYNDIV2=1,SYNDIV1=1,SYNDIV0=1 */
setReg8(CPMUSYNR, 0x5FU); /* Set the multiplier register */ --> Crash