Hi everyone, I am having trouble switching a PPC5606 to external clock.
I'm basically trying to run the demo code CW_FTF_V3 from "Demo code to test functionality of Spectrum Cluster Board". Now, the demo code is 3 years old, and my CPU has mask set 1M25V, maybe there has been some change in the clock module? I checked the code against the MPC5606RM, and I haven't found what may be the problem. Anyway, here's the code:
// disable watchdog SWT.SR.R = 0x0000c520; /* key */ SWT.SR.R = 0x0000d928; /* key */ SWT.CR.R = 0x8000010A; /* disable WEN */ /* Enbable all peripheral clocks */ CGM.SCDC.R = 0x80808080; /* Setting RUN Configuration Register ME_RUN_PC */ ME.RUNPC.R=0x000000FE; /* Peripheral ON in every mode */ CGM.OCDSSC.B.SELCTL=1; //Select Fast IRC (16 MHz) as clock output /* Re-enter in DRUN mode to update */ ME.MCTL.R = 0x30005AF0; /* Mode & Key */ ME.MCTL.R = 0x3000A50F; /* Mode & Key */ ME.DRUN.B.XOSC0ON=1; /* Switch on external osc */ ME.DRUN.B.SYSCLK=3; /* Select external osc */ /* RE enter the drun mode, to update the configuration */ ME.MCTL.R = 0x30005AF0; /* Mode & Key */ ME.MCTL.R = 0x3000A50F; /* Mode & Key inverted */ while(ME.GS.B.S_OSC==0) ; /* Wait for external osc to stabilize */ ;
...and this is where it hangs. External osc never comes up. However, it's a simple 8 MHz crystal with a pair of 20p caps to ground, about 5mm from the CPU pins. I don't see why it wouldn't oscillate. Am I missing something? Is there some sort of external requirement to switch the osc on? Or is there a bit that needs to be set somewhere to enable it?
Any help would be appreciated!
Best regards, Oliver