Problem with XMEGA - clock setting to internal 32Mhz.

General discussion on mikroC PRO for AVR.
Post Reply
Author
Message
alealmeidaj
Posts: 2
Joined: 15 May 2014 17:04

Problem with XMEGA - clock setting to internal 32Mhz.

#1 Post by alealmeidaj » 15 May 2014 17:12

Hi everyone,

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;
    

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Problem with XMEGA - clock setting to internal 32Mhz.

#2 Post by marina.petrovic » 20 May 2014 12:38

Hi,

Unfortunately, I don't have the same hardware that you use, so I am not able to test your code.
In datasheet of the microcontroller that you use, you should be able to find detailed explanation how to set oscillator properly:
http://www.atmel.com/Images/Atmel-8069- ... asheet.pdf

Best regards,
Marina

Post Reply

Return to “mikroC PRO for AVR General”