I want to generate two pulses with 100 kHz frequency as shown,
So I used the updown_RC mode for the blue wave and up_RC for the orange wave, but I don't see any outputs on the Due. Since this doesn't need to do anything on interrupt, I did not include a handler(). I am using TIOA8 and TIOA0 channels to get the waves.
Also, how do I ensure that the wave will be high at first and resets when it matches RA value?
I want to get the TIOA waveform as shown here in this image from the ATMEL SAM3x8e datasheet.
void setup(){
//Waveform on TIOA8 i.e TC2 Ch2, pin no Port D.7 pin D11
PMC->PMC_PCER1 |= PMC_PCER1_PID35;
PIOD->PIO_PDR |= PIO_PDR_P7; //Disable GPIO on D.7
PIOD->PIO_ABSR |= PIO_PD7B_TIOA8;
TC2->TC_CHANNEL[2].TC_CMR = TC_CMR_TCCLKS_TIMER_CLOCK1
| TC_CMR_WAVE
| TC_CMR_WAVESEL_UP_RC
| TC_CMR_ACPA_CLEAR
| TC_CMR_ACPC_SET;
TC2->TC_CHANNEL[2].TC_RC = 420; //100 kHz frequency, sawtooth waveform
TC2->TC_CHANNEL[2].TC_RA = 218; //Calculated corresponding to RC
////////////////////////////////////////////////////
//Waveform on TIOA0 FOR SWITCH S1
PMC->PMC_PCER0 |= PMC_PCER0_PID27; //TC0 CH0
PIOB->PIO_PDR |= PIO_PDR_P25; //Disable GPIO on B.25
PIOB->PIO_ABSR |= PIO_ABSR_P25;
TC0->TC_CHANNEL[0].TC_CMR = TC_CMR_ACPA_TOGGLE |
TC_CMR_WAVE |
TC_CMR_WAVESEL_UPDOWN_RC |
TC_CMR_TCCLKS_TIMER_CLOCK1;
TC0->TC_CHANNEL[0].TC_RC = 210;
TC0->TC_CHANNEL[0].TC_RA = 17;
}
void loop(){}
What am I missing here?