Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: ATxmega64A3 Capture TCD0.CCA problem

2011-08-02 by warm38spl

End of one problem and start of another.

The documentation (the version newer than the one I had) indicates that if PER is LESS THAN 0x8000, then CCA will contain 0x8000 for a Rising edge or 0x0000 for a Falling edge causing the input capture.  The number I used was much less than 0x8000, so that was the problem and all I needed to do is AND off the Rising-Edge indicator.

Now for the continuing saga...
Everything is now looking good ... except ...
I set up TCE1 for timing pulses as they are generated, and my oscilloscope agrees with what the TCE1.CNT says.

TCD1 is used by setting TDC1.PER to the time for the next signal.
As in
Code:
    VPORT2.OUT |= SIG_ENT_ON;
    tcd0inta = TCE1.CNT;  /* ### for DEBUG timing ### */
    TCD1.PER = nextIntrTime;

Also, as I said earlier I'm using TDC0 to find when an event occurs (do input capture on EVENT0 B1 rising). If no event occurs, I have set up TCD0 with the overflow of 0x65F.

Here is the weirdness that I am experiencing:

A signal occurs at 62 microSec. Running at 32MHz means it occurs at 0x7C0 cycles. And 50 microSec after that signal will come the final signal at 112 microSec which is 1600 (0x640) cycles or 50uSec later (subtracting out the instructions to set up the signal is about 60). I set TCD1.PER to 0x640 (to fire at 112uSec) but it fires at 0x8a6=69.1uSec (62uSec=7C0 cycles, diff is E4=228 cycles, not the 1600 I put in there). I even tried setting TCD1.PER to 0x80 and 0x1000 and it STILL fires about the same time +/- 4cycles.

Also, the afore mentioned TCD0 overflow is supposed to fire at about 66uSec out of 112 uSec. It ALWAYS fires AFTER the 0x8A4 time of the "final" signal (0x8BA=69.8uSec). I tried to get it to fire earlier or later, but setting TCD0.PER does not seem to make any difference either when I'm coming to to final signal in the sequence.

So, any ideas why TCD0.PER and TCD1.PER appear to ignore the values I put in them? I do the same sequence for all the other signals and only on this one signal do they ignore me. I don't like my processors to ignore me. (insert glare at processor here)

Any suggestions as to what I should try looking for?
I dump out PER CNT CCA for TCD1 and at every signal I use TCE1.CNT to get the timing of each signal. My O'scope agrees with TCE1.CNT, so I know TCE1 is working, but what happens to TCD0 and TCD1 and firing off the overflow whenever it wants to, not based on PER?

wade

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.