> Christopher Friedt wrote:
>> Hi list and TS support,
>>
>> I'm trying to use the XDIO pulse timer on my TS-7260 for a practical
>> purpose, since it allegedly can off-load pulse timing from the CPU
>> (see datasheet [1]). Since it initially wouldn't work for my app using
>> code that I wrote without performing any prior testing of XDIO, I
>> wrote a very simple routine [2] to test if the XDIO pulse timer is
>> accurate. However, It clearly fails the test [3].
>>
>> The test attempts to use the pulse timer to measure the pulse width of
>> an output signal on pin 4 (note that the datasheet states the timer
>> works both with input and output pins).
>>
>> This leads me to ask a few very basic questions for clarification:
>>
>> What does TS mean by neg-edge / pos-edge? It's not really common
>> industry jargon, so I can only guess there are 2 possible
>> interpretations
There are actually four modes for measuring pulses: the API defines for
these are:
PULSE_LOW_TIME (also called NEGEDGE_TO_POSEDGE)
PULSE_HIGH_TIME (also called POSEDGE_TO_NEGEDGE)
PULSE_PERIOD_LOW (also called NEGEDGE_TO_NEGEDGE)
PULSE_PERIOD_HIGH (also called POSEDGE_TO_POSEDGE)
>> 1) neg-edge == falling edge, pos-edge == rising edge
>> 2) neg-edge == logic low, pos-edge == logic high
It looks like you are using PULSE_HIGH_TIME and PULSE_PERIOD_LOW. The
former measures from the positive edge of the input to the negative
edge, therefore it measures how long the signal is high. The second
measures from negative edge of signal until the next negative edge,
therefore it measures the period of the signal with respect to the
negative edges.
>> Regardless of the interpretation, I made 4 test cases for brevity's
>> sake, and neither of them worked.
>> 1) sync flag set, using interpretation 1
>> 2) sync flag set, using interpretation 2
>> 3) sync flag not set, using interpretation 1
>> 4) sync flag not set, using interpretation 2
>>
>> Has anyone actually had success using the pulse timer? Is there any
>> possibility that I'm misinterpreting something on the datasheet, or
>> that the datasheet is actually wrong ?
The problem is that you are initializing the pulse timer after setting
the line low. This seems to be a side effect of initPulseTimer(). But
since you want to measure from positive edge to negative edge, you need
to make sure the line is low before initiating the pulse. Reversing the
order will fix the problem...
>>
>> dprintf( "setting pin 4 to LOW\n" );
>> setPin( xdp, 4, LOW );
>>
>> dprintf( "initializing pulse timer to use PULSE_HIGH_TIME\n" );
>> initPulseTimer( xdp, 4, 0, PULSE_HIGH_TIME );
change this to:
dprintf( "initializing pulse timer to use PULSE_HIGH_TIME\n" );
initPulseTimer( xdp, 4, 0, PULSE_HIGH_TIME );
dprintf( "setting pin 4 to LOW\n" );
setPin( xdp, 4, LOW );
This part is ok:
>> dprintf( "creating a %d000-T (%d us) pulse\n", mult, mult * T );
>> generatePulse( xdp, mult * T * 1000 );
>>
>> nsll = getPulseTimer( xdp, sync, reset );
>> dprintf( "pulse high time is %d ns\n", (int) nsll );
>>
You can discard the rest of the code, as the first test is measuring the
high-time, which I think is what you want.
>> ==============================================================
>> $ ./xdioTest
>> debug: set clock period, T, to 68 ns
>> debug: setting pin 4 direction to OUTPUT
>> ================================================================================debug:
>>
>>
>> setting pin 4 to LOW
>> debug: initializing pulse timer to use PULSE_HIGH_TIME
>> debug: creating a 4000-T (272 us) pulse
>> debug: pulse high time is 68 ns
>> ================================================================================debug:
>>
Here is what I see...
$ ./xdioTest
debug: set clock period, T, to 68 ns
debug: setting pin 4 direction to OUTPUT
================================================================================debug:
initializing pulse timer to use PULSE_HIGH_TIME
debug: setting pin 4 to LOW
debug: creating a 4000-T (272 us) pulse
debug: pulse high time is 272136 ns
______ Best Regards,
|__ __/ Michael Schmidt
|| Software Engineer
||echnologic Systems (EmbeddedARM.com)
|| (480) 16525 East Laser Drive
|/ 837-5200 Fountain Hills, AZ 85268
http://oz.embeddedarm.com/~michael
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|