Hi, I have a custom board that uses an AT32UC3AO256 and created a new project using the user application template for the User Board - UC3A0/A1. So far all good. I set up some I/O using gpio functions and all worked perfectly. I then decided to use the external 12MHz xtal OCS0 so i added the asf clock control module and added the following to user_board.h
#define BOARD_OSC0_HZ 12000000 #define OSC_ID_OSC0 0 //!< External Oscillator 0 #define BOARD_OSC0_STARTUP_US OSC_STARTUP_4096
Code all compiled ok but no go as it hangs on waiting for the xtal to satrt so i am obviously missing something in board.h
I tried the following code:
//Configure the oscillator 0 in crystal mode. AVR32_PM.oscctrl0=AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G3<<AVR32_PM_OSCCTRL0_MODE_OFFSET | 3<<AVR32_PM_OSCCTRL0_STARTUP_OFFSET; //Enable the oscillator 0. AVR32_PM.mcctrl |= AVR32_PM_MCCTRL_OSC0EN_MASK; //Wait for oscillator 0 to be ready. while (!(AVR32_PM.poscsr & AVR32_PM_POSCSR_OSC0RDY_MASK)); //Switch main clock from internal RC oscillator to oscillator 0. AVR32_PM.mcctrl |= AVR32_PM_MCCTRL_MCSEL_OSC0;
and all worked perfectly.
So basically i wnat to get the asf code going.
Any help would be greatly appreciated.