First of all, let me wish you all a Happy New Year.
Now, lets get to the topic.
I am using a SAM E70 Xplained Development Board & I some how managed to get its timer 0 - channel 0 working using the example code provided in Atmel Studio.
In our current project, we are supposed to use multiple timers to get the logic working. As per datasheet, there are 12 16-bit timer modules in SAM E70. So, I tried to get the code working for other timers. What I did was that, I changed all "TC0" in timers configurations to different timers along with their ISR.
The code compiled successfully, but the program refused to work.
There are only a few steps to configure timer module, but still I have got no idea where I have gone wrong.
Basic Timer Initialization
ul_sysclk=sysclk_get_cpu_hz();
pmc_enable_periph_clk(ID_TC0);
tc_find_mck_divisor(100,ul_sysclk,&ul_div,&ul_tcclks,ul_sysclk);
tc_init(TC0,0,ul_tcclks|TC_CMR_CPCTRG);
tc_write_rc(TC0,0,TC_IER_CPCS);
tc_start(TC0,0);
ISR
TC0_Handler(void)
{
volatile uint32_t ul_dummy;
ul_dummy=tc_get_status(TC0,0);
}
This code works perfectly & I am able to configure timer interrupt frequency.
But when I try to change the timer, it stops working.