I've used PWM a lot on the regular megas, but fail to make it work on an xmega. I'm using the ATxmega128A1, running at 30 MHz.
I've read the relevant values (those I think are relevant) directly from the registers, so I'm sure that the values are as listed below:
PORTC_DIR=0x9B; // PC7, PC4, PC3, PC1 and PC0 set as outputs PR_PRPC=0x0C; // SPI and HIRES disabled on port C TCC1_CTRLB=0x13; // Single slope PWM; CCA compare output enabled TCC1_CTRLC=0; TCC1_CTRLD=0; // All event stuff off TCC1_CTRLE=0; // Byte mode off TCC1_PER=0x0BB7; // Period register set to 2999 TCC1_CCA=0x001F; // Compare register set to 31 TCC1_CTRLA=0x01; // Timer enabled, no prescaling
I expected to get a 10 kHz signal on PC4, with a pulse width of a little more than 1 Âµs. Instead, I get a constant low. I've studied the Xmega A manual and several posts here, including this one:
So far, no result. Am I missing something obvious?