SAM E70 Timer Counter confusion

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

After spending some time with the Atmel SMART E70 datasheet (dated 19 Jun 15), I might just as well share my findings with you:

 

I could simply not start anything else but TC0, channel 0. The reason turned out to be that each channel has its own peripheral identifier (PID23-28 and PID47-52).

 

I e, there is not one PID per module (TCx), which one might think when reading p. 1355, where the IDs for the interrupts are listed.

 

The same PID is supposed to be used for both PMC and INT according to p. 258, so I am inclined to believe that the information on p. 1355 is incorrect.

 

 

 

 

 

 

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

Hi,

If you have successfully configured the timer module along with its interrupts, please do share a simple code.smiley
 

Silly beans are always silly
:)

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

Hi,

 

I'm not sure if you mixed up something. The V70 has separate PIDs for each Channel of each Timer. The E70 has not.

 

Best Regards

Markus

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

Hi Markus,

according to table 13-1 in the datasheet (rev D, jan 16), PID23-28 and 47-52 are used by channel 0..11.

 

I e, there are separate PIDs for each channel of the timer.

 

Please let me know if you make a different interpretation.

 

BR

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

Hi BR,

 

I guess my (and those of others) confusion came from the wording.

In many parts of the datasheet TCx is the naming of a TC-block that consists of three channels. In the reference you mentioned the timer channels are listed continously from 0-11. However they have the same wording (or better acrony) than an entire timer block that is described in chapter 48. If you have a look at table 48-4 you might be better understand what I mean. This table adresses with TCx an entire block and not only a timer channel. So for me something like TCx-y where x goes from 0-3 and y from 0-2 might be a better wording to distinguish between timer blocks and timer channels.

 

Best Regards

Markus

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

Hi Markus,

glad to hear that I am not the only one finding the datasheet to be inconsistent when it comes to naming of the TC modules and channels.

 

It seems to me that table 48-4 has correct naming, but 13-1 should be renamed to clearly indicate that the instances are channels, not modules (it says channels in the description, but the instance name is incorrect). Rather confusing when you are new to the device.

 

To make things worse, the header files from ASF have a large gap:

 

The file same70n20.h from ASF defines TC IRQn 23..25 and 50..52, the rest are left out. 
The same goes for declarations of TCx_HANDLER, only 0..2 and 9..11 are declared.

 

I have managed to get module 0 up and running with three different timers and one interrupt, but simply had to give up on module 1 due to lack of time.

 

Best regards

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

Same here...I wasted so much time tracking what is what from datasheet to code, back to datasheet and so on. I am using ASF4 and it is missing too many features on the top level, I am almost always using hri functions for configuring peripherals.

 

I am right now configuring the E70/S70 timers to be tied to quadrature encoders. It has been painful so far, and I just realised I can't even write the value I want to update the CV (the counter value itself) registers when needed (I am porting a project from an atxmega and this was a feature). I know this is not a documentation issue but it just increased a bit more the number of desk head bashings frown. I guess I will have to drag the numbers in software and buffer the CVs...the quadrature decoders were precisely there to offload the core...anyway. They are half-offloading it now. Not amazed by this ARM M7 yet...let's see how things go when I can test things properly.

 

In same70q21.h you have the following,  btw:

void TC0_Handler              ( void );
void TC10_Handler             ( void );
void TC11_Handler             ( void );
void TC1_Handler              ( void );
void TC2_Handler              ( void );
void TC3_Handler              ( void );
void TC4_Handler              ( void );
void TC5_Handler              ( void );
void TC6_Handler              ( void );
void TC7_Handler              ( void );
void TC8_Handler              ( void );
void TC9_Handler              ( void );

Has the same70nXX got the 4 timers or just 2? I had to go with the same70qXX because the same70nXX only had 1 quadrature decoder exposed, and I needed more. The same70qXX seems to have 4, support said so (the datasheet again, is a disaster):

On 144 pin package, the QDEC implementation is possible on all the four timer instances.

TC0: PA0, PA1, PA16.
TC1: PC23, PC24, PC27.
TC2: PC5, PC6, PC9.
TC3: PE0, PE1, PE4
.
On 100 pin package, the QDEC implementation is possible on only one timer instance.

TC0: PA0, PA1, PA16.

 

 To be tested though... I'll post my findings.

Last Edited: Mon. Feb 6, 2017 - 04:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Confirmed although it is a pain to get them going properly... The documentation for QDECs seems to be the same (and incomplete) as for the SAMs cortex M4...

And for the timers, I can't even find where the WAVSEL bits are defined. The CMR register seems to have the same address for CAPTURE and WAVE modes, but the bits have only been defined when the register is used in CAPTURE mode, I can't set the WAVSEL bits, it's starting to be a bit of a hassle.