[SOLVED]: Confusion about timer defines

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

I didn't find a document that explains this issue, perhaps I'm using the wrong search words.

I'm talking about the timer defines like `TC_CLKSEL_OFF_gc`. Initially they were like this one, say `TC_*`.

 

After some updates (but I cannot recall when) they changed to `TC_TC0_*` or `TC_TC1_*`, i.e. `TC_TC0_CLKSEL_OFF_gc`.

So I had to change all my code to match this new syntax.

 

Today I've reinstalled Atmel Studio on a new computer and the compiler now looks for the first syntax (`TC_*`).

Please, would you mind to help me to understand what it the newer syntax and how to stick with it across installations?

Last Edited: Mon. Sep 4, 2017 - 08:04 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Atmel made a mistake in the release of one of their "device packs" and TC/TC0 got swapped. So get a DFP update if affected. 

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

Thank clawson. I'm using a ATxmega32A4U and my code has the (newer?) TC_TC0_* syntax.

I did a DFP update for all XMEGA. In detail for the XMEGA_A family I installed the update 1.1.68, the latest. It now says it's "up to date" so I assume they are cumulative and I don't need to install older ones.

After rebooting Atmel Studio I tried again to compile my code but the compiler still doesn't accept the TC_TC0_syntax.

 

Did I get it wrong what you've suggested?

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

 

I have up-to-date device packs and found the following in iox32a4u.h:

 

typedef enum TC_CLKSEL_enum
{
    TC_CLKSEL_OFF_gc = (0x00<<0),  /* Timer Off */
    TC_CLKSEL_DIV1_gc = (0x01<<0),  /* System Clock */
    TC_CLKSEL_DIV2_gc = (0x02<<0),  /* System Clock / 2 */
    TC_CLKSEL_DIV4_gc = (0x03<<0),  /* System Clock / 4 */
    TC_CLKSEL_DIV8_gc = (0x04<<0),  /* System Clock / 8 */
    TC_CLKSEL_DIV64_gc = (0x05<<0),  /* System Clock / 64 */
    TC_CLKSEL_DIV256_gc = (0x06<<0),  /* System Clock / 256 */
    TC_CLKSEL_DIV1024_gc = (0x07<<0),  /* System Clock / 1024 */
    TC_CLKSEL_EVCH0_gc = (0x08<<0),  /* Event Channel 0 */
    TC_CLKSEL_EVCH1_gc = (0x09<<0),  /* Event Channel 1 */
    TC_CLKSEL_EVCH2_gc = (0x0A<<0),  /* Event Channel 2 */
    TC_CLKSEL_EVCH3_gc = (0x0B<<0),  /* Event Channel 3 */
    TC_CLKSEL_EVCH4_gc = (0x0C<<0),  /* Event Channel 4 */
    TC_CLKSEL_EVCH5_gc = (0x0D<<0),  /* Event Channel 5 */
    TC_CLKSEL_EVCH6_gc = (0x0E<<0),  /* Event Channel 6 */
    TC_CLKSEL_EVCH7_gc = (0x0F<<0),  /* Event Channel 7 */
} TC_CLKSEL_t;

/* Timer/Counter Command */
typedef enum TC_CMD_enum
{
    TC_CMD_NONE_gc = (0x00<<2),  /* No Command */
    TC_CMD_UPDATE_gc = (0x01<<2),  /* Force Update */
    TC_CMD_RESTART_gc = (0x02<<2),  /* Force Restart */
    TC_CMD_RESET_gc = (0x03<<2),  /* Force Hard Reset */
} TC_CMD_t;

 

There's a lot more where that came from.

 

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

Yes, that's the same I have. Unfortunately there are no versions indication inside the headers.

 

Bottom line: initially Atmel used the TC_* syntax, then they messed up something and switched to TC_TC0_*, eventually they came back to the TC_* as our "up-to-date" headers show. Might I assume this is correct and update (again) all my code?

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

I'd make the effort to update the code to the corrected TC_* version, but keep in mind that Atmel Studio allows you to have multiple versions of the headers installed and selected on a per-project basis. In fact if you are not careful and you just keep hitting "update", it installs every version of every pack and your C: drive fills up with gigabytes of headers.

 

If you open a project that uses a version you don't have, it will download that version for you.

Last Edited: Mon. Sep 4, 2017 - 08:04 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BTW AS7 lets you keep multiple DFPs on the disk and configure a project to pick one. So you should be able to cater for any eventuality.

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

iw2nzm wrote:

Might I assume this is correct and update (again) all my code?

 

Yup, the TC_ is the one that should be there. See http://www.atmel.com/images/doc8...