Skip to main content
Visitor II
August 17, 2005
Question

switching between main oscillator and 32khz crystral

  • August 17, 2005
  • 2 replies
  • 560 views
Posted on August 17, 2005 at 12:14

switching between main oscillator and 32khz crystral

    This topic has been closed for replies.

    2 replies

    ben2Author
    Visitor II
    August 16, 2005
    Posted on August 16, 2005 at 09:44

    I am having big trouble switching from 48mhz clock to the 32khz crystal oscillator.

    I am using the following code to switch the the CLK_AF source and then check the status to make sure it has switched as per the data sheet

    ''Note: To check if the selection has actually occurred, check that CKAF_ST is set. If no Real Time Clock is present, the selection will not occur.''

    GPIO0->PD |= BIT16_13;

    do {

    RCCU->CCR |= 0x00000004;

    }while( (RCCU->CFR &0x00000004) ==0 );

    GPIO0->PD &= ~BIT16_13;

    The problem is it appears the the clock source does indeed switch as can be seen from the clockout pin, however it can sometimes take as long as 8-10 seconds to exit the loop. This has been verified by measuring the pulse on GPI0.13. Sometimes it will switch without any problems.

    The CKAF_SEL bit in the RCCU_CFR register is obviously not being set correctly ! Is this a silicon bug ? There seems no point in checking this bit as it doesnt acurately indicate if the clock switch has actually occured. Also it seems to be different between 2 different chips.

    Has anyone else experienced similar problems ?

    ben2Author
    Visitor II
    August 17, 2005
    Posted on August 17, 2005 at 12:14

    I agree that there is a problem. The bigest one of which is I see 32khz coming out of the clkout pin so the chip must have switched clock sourcesand yet the status does not appear to reflect the change.

    I have 3 boards with identical software. It seems to be more of a problem on 2 of the boards, and it does appear to be random. Often it will pass right through the while loop without a problem.