Xmega-E5 Cascade timers

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

Hi Freaks,

I have board with XMEGA-E5. I would like use 2 timers in cascade with ESYS.
After initialize the first interrupt (callback calling) comming after expected time, but every next comming very quickly.

IRQ enabling is in main routine

void timerInit(void){

sysclk_enable_module(SYSCLK_PORT_GEN, SYSCLK_EVSYS);
EVSYS_CH0MUX = EVSYS_CHMUX_TCC4_OVF_gc;
	 
tc45_enable(&TCC4);
tc45_set_wgm(&TCC4, TC45_WG_NORMAL);
tc45_write_period(&TCC4, 32000);
tc45_set_overflow_interrupt_level(&TCC4, TC45_INT_LVL_LO);
tc45_write_clock_source(&TCC4, TC45_CLKSEL_DIV8_gc);
	 
tc45_enable(&TCC5);
tc45_set_overflow_interrupt_callback(&TCC5, myTimer_callback);
tc45_set_wgm(&TCC5, TC45_WG_NORMAL);
tc45_write_period(&TCC5, 10000);
tc45_set_overflow_interrupt_level(&TCC5, TC45_INT_LVL_LO);
tc45_write_clock_source(&TCC5, TC45_CLKSEL_EVCH0_gc);
}

void myTimer_callback(void)
{
   // My Code for LED controll
}

Any idea... ?

Last Edited: Fri. Aug 15, 2014 - 11:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I simulate it: The first "round" is OK, from one Timer to next. But after return from callback, first timer freeze CNT stay 0, and with counting continues only the second Timer - Event_CH0 is sets like CLOCK source, but its counting like from standard Clock.