XPlained : using onboard 12MHz osc to clock ATxmega128-A1

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I need a crystal source for the ATxmega128-A1 on my Xplained Xmega-A1 board.
Since 12MHz oscillator of the AT32UC3B1256 is only 2cm far from PR1 pin of J3, I tried to strap 'TP OSC' (connected to XOUT0 of AT32UC3) with PR1 of ATxmega.

I am using this code but it blocks when waiting for XOSCRDY (seems to be not stable ?) :

		CLKSYS_Prescalers_Config( CLK_PSADIV_2_gc, CLK_PSBCDIV_1_1_gc );
		OSC.XOSCCTRL=OSC_FRQRANGE_12TO16_gc|OSC_XOSCSEL_EXTCLK_gc;
		CLKSYS_Enable( OSC_XOSCEN_bm ); //enable ext oscillator
		do {} while ( CLKSYS_IsReady( OSC_XOSCRDY_bm ) == 0 );
/*		OSC.PLLCTRL=(OSC_PLLSRC_XOSC_gc|(5<<OSC_PLLFAC_gp));		//PLL input=12M, fact=5
		CLKSYS_Enable( OSC_PLLEN_bm ); //enable PLL
		do {} while ( CLKSYS_IsReady( OSC_PLLRDY_bm ) == 0 );
*/		CLKSYS_Main_ClockSource_Select( CLK_SCLKSEL_XOSC_gc );
//		CLKSYS_Main_ClockSource_Select( CLK_SCLKSEL_PLL_gc );

Is someone has a clue ?

Best Regards

Doom

AVR inside