Author Topic: AVR32UC3B Clock Setup  (Read 1660 times)

0 Members and 1 Guest are viewing this topic.

Offline Jacky_88Topic starter

  • Contributor
  • Posts: 27
  • Country: de
AVR32UC3B Clock Setup
« on: June 11, 2017, 03:07:27 pm »
Hello,

i'm starting to use 32bit AVRs and I have a problems setting up the main clock.

Code: [Select]
int main(void)
{
AVR32_PM.MCCTRL.osc0en = 1;
AVR32_PM.OSCCTRL0.mode = 7;
AVR32_PM.OSCCTRL0.startup = 0;

while(!AVR32_PM.POSCSR.osc0rdy)
{
;
}

  AVR32_PM.PLL[0].pllcount = 16;
  AVR32_PM.PLL[0].pllmul = 9;
  AVR32_PM.PLL[0].plldiv = 1;
  AVR32_PM.PLL[0].pllopt = 3;
  AVR32_PM.PLL[0].pllosc = 0;
AVR32_PM.PLL[0].pllen = 1;
 
    while(!AVR32_PM.POSCSR.lock0)
    {
    ;
    }
AVR32_PM.MCCTRL.mcsel = 2;

AVR32_GPIO.port[0].gpers = (1 << 31);
AVR32_GPIO.port[0].oders = (1 << 31);
AVR32_GPIO.port[0].ovrs = (1 << 31);

    while (1)
    {

AVR32_GPIO.port[0].ovrt = (1 << 31);
    }
}



As far as chapter 9 says, these seetimgs result in a fVCO of 120 MHz (12MHz crystal) and a PLL frequency of 60 MHz. But the settings still don't work. The PLL lock flag never changes resulting in an endless loop  :-\
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: AVR32UC3B Clock Setup
« Reply #1 on: June 11, 2017, 09:14:18 pm »
i'm starting to use 32bit AVRs
Why? This is one bad move. Just use ARM, you will get better variety of parts and actual support.
Alex
 

Offline Jacky_88Topic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: AVR32UC3B Clock Setup
« Reply #2 on: June 11, 2017, 09:46:49 pm »
That is due to the availability of ARM from Atmel in germany. German stores don't offer them (as far as I know) and so I decided to start with the UC3B which is available here. The STM32-F1-series is also available here, which looks interesiting to me too. It would come at lower price for controllers and programmer (Dragon / ICE vs. ST Link V2), but has a huge downside with it's not existing IDE. I've already lying a NUCLEO on my desk.  Actually I'm very happy with Atmel and it's visual studio clone and depending on my experience with the AVR32 I would consider buying the ARMs from digikey.com in the future. As a hobbyist I have to consider the shipping fees, when ordering chips from digikey, farnell or mouser or have to purchase beyond some limit to get free shipping. But you're right, these SAMD look very nice  :D
« Last Edit: June 12, 2017, 07:16:15 am by Jacky_88 »
 

Offline Jacky_88Topic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: AVR32UC3B Clock Setup
« Reply #3 on: June 23, 2017, 07:49:14 pm »
The code works. Since I'm, using a simple QFP adapter I had to wire it all manually and I conected the PLL supply to the wrong voltage line.  |O
« Last Edit: June 23, 2017, 07:55:24 pm by Jacky_88 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf