Rob Nijhuis

MCF52221 PLL question

Discussion created by Rob Nijhuis on Jul 3, 2008
Latest reply on Jul 4, 2008 by Rob Nijhuis
Hi,
 
We are clocking the MCF52221 from it’s internal relaxation oscillator, PLL'd up to 48MHz. We have found out that the relaxation oscillator runs too fast  for USB to work correctly. We have found out that the relaxation oscillator has a tolerance of 32,500 ppm. In case we place an external oscillator, the problem is solved. We don’t like to do a hardware redesign of our product. So the question is how to solve this problem (in software). Is this possible ?
 
We played with the ROCR register to use the trim bits to changes the frequency, however no mather the value we write we don't see a change. We use the following code to setup the PLL
 
 // set PLL to 6x, so system clock is set to 8MHz osc * 6 = 48 MHz, needed for USB.
 MCF_CLOCK_CCHR = 0x00;
 MCF_CLOCK_SYNCR = MCF_CLOCK_SYNCR_MFD(1) | MCF_CLOCK_SYNCR_RFD(0) | MCF_CLOCK_SYNCR_PLLMODE | MCF_CLOCK_SYNCR_PLLEN;
    // wait for pll to lock
    while (!(MCF_CLOCK_SYNSR & MCF_CLOCK_SYNSR_LOCK))
     ;
    // switch over from reference clock to PLL output
    MCF_CLOCK_SYNCR = MCF_CLOCK_SYNCR_MFD(1) | MCF_CLOCK_SYNCR_RFD(0) | MCF_CLOCK_SYNCR_PLLMODE |
     MCF_CLOCK_SYNCR_PLLEN | MCF_CLOCK_SYNCR_CLKSRC;
If anyone has any ideas...please let me know.
 
Thanks,
Rob

Outcomes