I've been putting together the clock configuration routines for a project and have ran into some inconsistencies with the manual for the xmega16e.
On page 95 of the manual (Rev Atmel–42005E–AVR–XMEGA E–11/2014 which I'm 99.9% is the most recent), the clock system diagram indicates that the output from the 32 Mhz internal oscillator can be selected as an input clock for the PLL AFTER passing through a divide by four counter. There's a couple of other places in the manual that mention this as well. I have my clocks setup and working, but there is absolutely no evidence that this /4 is happening.
If all multiplier and dividers between the 32 Mhz internal oscillator and the system clock output are set to one, I get 32 Mhz on PINC7. I would expect to get 8 (32/4).
Does anyone know if this is a bug or some kind of error in the datasheet?
Which brings me to my second question, clock output to a pin. I have pinc7 configured to output the system clock (assume clk1x for now) All of my observations have been based on the output of this pin.
Given I have the following, and it's working:
32Mhz Int. Osc (Running @ 36 Mhz). ->36 Mhz-> PLL *2/2 ->36Mhz->Prescale A (/1) -> 36 Mhz->Prescale B(/2)->18 Mhz->Prescale C (/2)-> 9 Mhz -> Clkper Clkcpu
Peripheral clocks 4x, 2x and 1x should be 36 Mhz, 18 Mhz and 9 Mhz respectively.
With
; Output RTC Clock on PORTC, PIN6. Output system clock on PC7, Clkper
ldi r31, PORTCFG_RTCCLKOUT_PC6_gc | PORTCFG_CLKOUT_PC7_gc | PORTCFG_CLKOUTSEL_CLK1X_gc
sts PORTCFG_CLKOUT,r31
I measure 9Mhz on PC7, which is what I would expect
; Output RTC Clock on PORTC, PIN6. Output system clock on PC7, Clkper
ldi r31, PORTCFG_RTCCLKOUT_PC6_gc | PORTCFG_CLKOUT_PC7_gc | PORTCFG_CLKOUTSEL_CLK2X_gc
sts PORTCFG_CLKOUT,r31
I get NOTHING on PC7, but uC is operating just fine, still responding to USART I/O, etc. I would expect 18 Mhz
; Output RTC Clock on PORTC, PIN6. Output system clock on PC7, Clkper
ldi r31, PORTCFG_RTCCLKOUT_PC6_gc | PORTCFG_CLKOUT_PC7_gc | PORTCFG_CLKOUTSEL_CLK4X_gc
sts PORTCFG_CLKOUT,r31
I measure 9Mhz on PC7, I would expect 36 Mhz
Does anyone know if this is a bug too???
Or if I've missing some configuration somewhere?