Xmega Newbie question: timer overflow

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

Hi,

I’m having a little issue getting the timer overflow interrupt operational using ASF.

I have an Xmega-E5 xplained board.  The “LED chaser” example program loaded up, downloaded to the board, and ran.  My next step was to get the timer/counter overflow interrupt working in the starting project.

I found this example:

http://asf.atmel.com/docs/3.22.0/xmegad/html/xmega_tc_quickstart.html

So, I copied the example code into my simple program and I’m getting the errors:

C:\Users\mmeer\Documents\Atmel Studio\6.2\LED_CHASER1\LED_CHASER1\src\led_example.c(35,2): error: implicit declaration of function 'tc_enable' [-Werror=implicit-function-declaration]

                tc_enable(&TCC0); //Enable timer/counter TCC0

                ^

C:\Users\mmeer\Documents\Atmel Studio\6.2\LED_CHASER1\LED_CHASER1\src\led_example.c(35,13): error: 'TCC0' undeclared (first use in this function)

                tc_enable(&TCC0); //Enable timer/counter TCC0

 

I’m using Atmel Studio 6.2.1563 with ASF 3.21.0.  I think my main problem is with the ASF.   The example states these two items need to be added to the project:

For the setup code of this use case to work, the following must be added to the project:

    Global Interrupt Management
    Clock Management

But, I don’t see those exact options available.  The closest I see is PMIC and TC4/5.  But, those  do not seem to work.

What I’m I doing wrong?

Matt

 

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

tc_enable() will be in the TC4/5 driver, which includes the System Clock Control Service and the PMIC Driver (see screen snip below).  The TC driver - at least the Xmega-A TC driver, creates ISR()s for all the TC interrupts snd you need to use the appropriate tc45_set_*_interrupt_callback() function to invoke your own callback function when the interrupt occurs.  See example project TC4/5 Example 1 - XMEGA-E5 Xplained (or something similar).  It has examples of creating callback functions.

 

 

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!