Been reading the timer section of the manual about five times now, but I can't figure out how to get the PWM output to work. Here's my code:
PORTD.DIRSET = 0xFF; //PORTD set as output
TCC0.CTRLA = 0b111; //Prescaler=1024
TCC0.CTRLB = 0b11110011; //All CC enabled. Single slope PWM enabled
TCC0.CTRLD = 0; //All events off
TCC0.PER = 512; //Frequency set to clk/512
TCC0.CCD = 256; //50% duty cycle
A LED is connected to PD0, it glows when simply setting the OUTSET register there are no hardware errors. When in single slope PWM mode, the output should be set at compare match and cleared at TOP, but I'm not sure wich of the four CC registers I should use, or perhaps all of them could be used to get a more complex waveform. PD0 is constantly LOW regardless of setting though, what am I doing wrong? Main clock frequency is set to 32Mhz.