SAMD20 timers based interrupt

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

Hi guys

 

I have just started working on SAMD20 and trying to make the timers work using ASF from the last two weeks but not getting any luck.

I am trying to debug it but not getting there.

Can anyone help me to understand the timers, i have gone through the datasheet but not making much sense to me and using ASF application but still it is not working.

 

I am trying to get the interrupt and make the led on after 2 seconds and then again turn that off after 10 seconds.

 

 

I have never worked on ARM before.

Your help will be much appreciated.

Thanks 
 

Attachment(s): 

It's a matter of start when you do, you find self confidence.

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

You have some variables that probably need to be "volatile."

 

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

Thanks!, I will try and will see if that works.

 

It's a matter of start when you do, you find self confidence.

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

How did you calculate the time that you want? 

 

Where can I find a way to calculate the timer that I'm looking for? (1ms)

 

Where do you increment the counter1 and counter2?

 

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

fabianpi wrote:
Where do you increment the counter1 and counter2?

 

There is no counter1 at all in the code...

 

Increment of counter2:

    // HERE:
	if((++counter2 > 31) && (timer1_flag==0 ))//2.04 sec
	{
	    .
	    .
	    .
	}
	// and HERE:
	else if((++counter2 > 155) && (timer2_flag==1))//10.04 sec

 

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]