Timer on pin UC3C1

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have problem with Timer0. I ran it and it works on interrupt but I want to get waveform on pin TC0-A1 (GPIO 54). How can I get it?

 

void tc_init(volatile avr32_tc_t *tc)
{
	
	gpio_enable_module_pin(AVR32_PIN_PB22, 0); // TC0-A1
	// Options for waveform generation.
	static const tc_waveform_opt_t waveform_opt = {
		// Channel selection.
		.channel  = TC0_CHANNEL,
		// Software trigger effect on TIOB.
		.bswtrg   = TC_EVT_EFFECT_NOOP,
		// External event effect on TIOB.
		.beevt    = TC_EVT_EFFECT_NOOP,
		// RC compare effect on TIOB.
		.bcpc     = TC_EVT_EFFECT_NOOP,
		// RB compare effect on TIOB.
		.bcpb     = TC_EVT_EFFECT_NOOP,
		
		// Software trigger effect on TIOA.
		.aswtrg   = TC_EVT_EFFECT_TOGGLE,
		// External event effect on TIOA.
		.aeevt    = TC_EVT_EFFECT_TOGGLE,
		// RC compare effect on TIOA.
		.acpc     = TC_EVT_EFFECT_TOGGLE,
		/*
		 * RA compare effect on TIOA.
		 * (other possibilities are none, set and clear).
		 */
		.acpa     = TC_EVT_EFFECT_TOGGLE,
		/*
		 * Waveform selection: Up mode with automatic trigger(reset)
		 * on RC compare.
		 */
		.wavsel   = TC_WAVEFORM_SEL_UP_MODE_RC_TRIGGER,
		// External event trigger enable.
		.enetrg   = false,
		// External event selection.
		.eevt     = 0,
		// External event edge selection.
		.eevtedg  = TC_SEL_NO_EDGE,
		// Counter disable when RC compare.
		.cpcdis   = false,
		// Counter clock stopped with RC compare.
		.cpcstop  = false,
		// Burst signal selection.
		.burst    = false,
		// Clock inversion.
		.clki     = false,
		// Internal source clock 3, connected to fPBA / 8.
		.tcclks   = TC_CLOCK_SOURCE_TC3
	};
	
	

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The above will toggle TIOA on ; Software Trigger, External event, RC compare, RA compare.
What condition do you really want TIOA to respond to ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From what I can decipher, it seems like you are configuring TC0 Channel 0.

If you want the A1 pin to toggle, you should configure channel 1 instead, as A1 is connected to channel 1.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, I didn't see that !.
(I managed to dream up a scenario where if RA was zero then the toggle on RA-compare-match would cancel-out the toggle on RC-compare-match.)