I have problems with setting the internal clock to 32Mhz. The xmega keeps working at 2Mhz.
Using the oscilloscope, I measured the time it takes to execute this command -> asm volatile ("nop");
It indicates that the atxmega32a4 is still working at 2mhz.
Can anyone help me?
Thanks in advance!
Code: Select all
OSC_CTRL|=(1<<1);
while(!(OSC_STATUS&OSC_RC32MRDY_bm));
CCP=CCP_IOREG_gc;
CLK_CTRL=CLK_SCLKSEL_RC32M_gc;
CCP=CCP_IOREG_gc;
CLK_PSCTRL=0;