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
1) neg-edge == falling edge, pos-edge == rising edge
2) neg-edge == logic low, pos-edge == logic high
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 ?
If the pulse timer in fact is non-functional, is there any chance that
TS could revise the FPGA core so that the pulse timer is functional,
and then post instructions for updating the FPGA manually?
Many thanks,
Chris
[1] XDIO Datasheet
====================================================================
http://www.embeddedarm.com/services/fpga-ipcore-xdio.php
[2] Source code
======================================================================
#include <stdio.h>
#include "xdio.h"
#include "core.h"
#define dprintf( fmt, ... ) printf( "debug: " fmt, ##__VA_ARGS__ )
int main( int argc, char *argv[] ) {
struct xdio *xdp, xd;
int T = 0; // ns
long long nsll = 0;
int mult = 4;
int sync = 1;
int reset = 1;
// open core 0 - only XDIO core on ts7260
if ( ! open_xdio( &xd, 0 ) ) {
dprintf( "failed to open xdio!\n" );
return -1;
}
xdp = &xd;
T = setClockSpeed( xdp, 1 ); // 1=FAST, returns clock period
dprintf( "set clock period, T, to %d ns\n", T );
dprintf( "setting pin 4 direction to OUTPUT\n" );
setPinDirection( xdp, 4, OUTPUT );
printf(
"================================================================================"
);
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 );
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 );
printf(
"================================================================================"
);
dprintf( "setting pin 4 to LOW\n" );
setPin( xdp, 4, LOW );
dprintf( "initializing pulse timer to use PULSE_PERIOD_LOW\n" );
initPulseTimer( xdp, 4, 0, PULSE_PERIOD_LOW );
dprintf( "creating a %d000-T (%d us) pulse\n", mult, mult * T );
generatePulse( xdp, mult * T * 1000 );
nsll = getPulseTimer( xdp, sync, reset );
dprintf( "pulse period low time is %d ns\n", (int) nsll );
printf(
"================================================================================"
);
dprintf( "disabling sync\n" );
sync = 0;
printf(
"================================================================================"
);
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 );
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 );
printf(
"================================================================================"
);
dprintf( "setting pin 4 to LOW\n" );
setPin( xdp, 4, LOW );
dprintf( "initializing pulse timer to use PULSE_PERIOD_LOW\n" );
initPulseTimer( xdp, 4, 0, PULSE_PERIOD_LOW );
dprintf( "creating a %d000-T (%d us) pulse\n", mult, mult * T );
generatePulse( xdp, mult * T * 1000 );
nsll = getPulseTimer( xdp, sync, reset );
dprintf( "pulse period low time is %d ns\n", (int) nsll );
printf(
"================================================================================"
);
/*
nsll = mult * T;
dprintf( "setting nsll to %d * T, which appears as %d when cast to an
int\n", mult, (int) nsll );
*/
dprintf( "setting pin 4 direction to INPUT\n" );
setPinDirection( xdp, 4, INPUT );
dprintf( "closing xdio\n" );
close_xdio( &xd );
return 0;
}
[2] Test Output
==============================================================
$ ./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:
setting pin 4 to LOW
debug: initializing pulse timer to use PULSE_PERIOD_LOW
debug: creating a 4000-T (272 us) pulse
debug: pulse period low time is 1132336 ns
================================================================================debug:
disabling sync
================================================================================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:
setting pin 4 to LOW
debug: initializing pulse timer to use PULSE_PERIOD_LOW
debug: creating a 4000-T (272 us) pulse
debug: pulse period low time is 0 ns
================================================================================debug:
setting pin 4 direction to INPUT
debug: closing xdio
------------------------------------
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/
|