Send commitlog mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r4212 - in developers/werner/ahrt/host/tmc: . examples
([EMAIL PROTECTED])
2. r4213 - in developers/werner/ahrt/host/tmc: . examples
([EMAIL PROTECTED])
--- Begin Message ---
Author: werner
Date: 2008-03-15 14:37:29 +0100 (Sat, 15 Mar 2008)
New Revision: 4212
Modified:
developers/werner/ahrt/host/tmc/README
developers/werner/ahrt/host/tmc/examples/usbtmc.py
developers/werner/ahrt/host/tmc/io.c
developers/werner/ahrt/host/tmc/python.c
Log:
Completed the repeat command functionality for "start", and did some
general cleanup.
- README: sending several samples over USBTMC causes loss of per-sample timing
- README: we now have DCI, but it doesn't always work yet
- README: implemented re-issuing READ?
- README: documented the optional "command" argument of "start"
- python.c (tmc_methods): removed left-over module method "stop"
- python.c (tmc_tp_methods): "start" is now METH_VARARGS, not METH_O
- io.c (debug): turned off debugging
- tmc/examples/usbtmc.py: use a sample size of one and a repeat command to
restart sampling
Modified: developers/werner/ahrt/host/tmc/README
===================================================================
--- developers/werner/ahrt/host/tmc/README 2008-03-15 03:22:57 UTC (rev
4211)
+++ developers/werner/ahrt/host/tmc/README 2008-03-15 13:37:29 UTC (rev
4212)
@@ -88,7 +88,7 @@
Asynchronous mode is entered with
- instr.start(filename)
+ instr.start(filename [, command])
This creates the specified file and start streaming instrument output to
the file. Instrument output is chopped into separate entries not only at
@@ -100,6 +100,10 @@
instr.send('*TRG')
+If the command argument is passed to "start", this command is issued at
+the end of a read to start another read cycle. Typically, this command
+will be 'READ?'.
+
The command
instr.stop()
@@ -181,7 +185,11 @@
samples. Instead, PicoTest suggest to use a large SAMP:COUN and to
re-issue READ? when running out of samples.
+One drawback of this work-around is that several samples are sent to
+the host en bloc and thus have the same timestamp. Therefore, the
+individual sample timing has to be reconstructed in this case.
+
Leaptronix mPP-3040D
--------------------
@@ -208,9 +216,6 @@
Passing an argument that doesn't want to be a string yields a segfault.
-Re-issuing READ? for the PicoTest M3500 should be implemented in the
-transport protocol driver.
-
There should be a way to detect whether an asynchronous acquisition has
completed, and also to synchronize with that event.
@@ -225,5 +230,5 @@
The USBTMC driver doesn't implement most of the error handling and.
-The USBTMC driver doesn't implement DCI, so the device has to be reset
-manually.
+The USBTMC driver doesn't implement DCI properly, so the device sometimes
+has to be reset manually.
Modified: developers/werner/ahrt/host/tmc/examples/usbtmc.py
===================================================================
--- developers/werner/ahrt/host/tmc/examples/usbtmc.py 2008-03-15 03:22:57 UTC
(rev 4211)
+++ developers/werner/ahrt/host/tmc/examples/usbtmc.py 2008-03-15 13:37:29 UTC
(rev 4212)
@@ -18,10 +18,10 @@
':VOLT:DC:RANG 10;'
':VOLT:RES 1e-4;'
':VOLT:NPLC 0.2;'
- ':SAMP:COUN 50000;'
+ ':SAMP:COUN 1;'
':READ?')
-d.start("usbtmc.out")
+d.start("usbtmc.out", 'READ?')
time.sleep(5)
Modified: developers/werner/ahrt/host/tmc/io.c
===================================================================
--- developers/werner/ahrt/host/tmc/io.c 2008-03-15 03:22:57 UTC (rev
4211)
+++ developers/werner/ahrt/host/tmc/io.c 2008-03-15 13:37:29 UTC (rev
4212)
@@ -23,7 +23,7 @@
#include "io.h"
-int debug = 1;
+int debug = 0;
/* ----- Asynchronous I/O -------------------------------------------------- */
Modified: developers/werner/ahrt/host/tmc/python.c
===================================================================
--- developers/werner/ahrt/host/tmc/python.c 2008-03-15 03:22:57 UTC (rev
4211)
+++ developers/werner/ahrt/host/tmc/python.c 2008-03-15 13:37:29 UTC (rev
4212)
@@ -206,7 +206,7 @@
static PyMethodDef tmc_tp_methods[] = {
{ "send", tmc_py_send, METH_VARARGS, "Send commands" },
{ "read", tmc_py_read, METH_NOARGS, "Read a response" },
- { "start", tmc_py_start, METH_O, "Start async logging" },
+ { "start", tmc_py_start, METH_VARARGS, "Start async logging" },
{ "stop", tmc_py_stop, METH_NOARGS, "Stop async logging" },
{ NULL, NULL, 0, NULL }
};
@@ -226,7 +226,6 @@
static PyMethodDef tmc_methods[] = {
- { "stop", tmc_py_stop, METH_NOARGS, "Stop async logging" },
{ NULL, NULL, 0, NULL }
};
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-03-15 22:37:01 +0100 (Sat, 15 Mar 2008)
New Revision: 4213
Modified:
developers/werner/ahrt/host/tmc/README
developers/werner/ahrt/host/tmc/examples/tty.py
developers/werner/ahrt/host/tmc/tty.c
Log:
Some cleanup of the tty driver.
- tty.c (struct tty_dsc, tty_open, tty_write), README: added option "echo" to
enable checking of command echo
- tty.c (struct tty_dsc, tty_open, tty_dci), README: added option "no_dci" to
disable sending of DCI
- examples/tty.py: use "no_dci"
Modified: developers/werner/ahrt/host/tmc/README
===================================================================
--- developers/werner/ahrt/host/tmc/README 2008-03-15 13:37:29 UTC (rev
4212)
+++ developers/werner/ahrt/host/tmc/README 2008-03-15 21:37:01 UTC (rev
4213)
@@ -155,12 +155,14 @@
The serial transport accepts the following arguments:
-[bps=N,] [crtscts,] device
+[bps=N,] [crtscts,] [echo,] [no_dci,] device
bps=N The speed of the serial interface. Default: use the
previous setting.
crtscts Use RTS/CTS flow control: Default: turn it off.
- device Device
+ echo The instrument echos back commands.
+ no_dci The instrument does not support the DCI function.
+ device Device
Instrument quirks
Modified: developers/werner/ahrt/host/tmc/examples/tty.py
===================================================================
--- developers/werner/ahrt/host/tmc/examples/tty.py 2008-03-15 13:37:29 UTC
(rev 4212)
+++ developers/werner/ahrt/host/tmc/examples/tty.py 2008-03-15 21:37:01 UTC
(rev 4213)
@@ -7,7 +7,7 @@
import tmc, time
-d = tmc.Instr("tty", "bps=9600", "/dev/ttyUSB0")
+d = tmc.Instr("tty", "bps=9600", "no_dci", "/dev/ttyUSB0")
d.send('*IDN?')
print d.read()
Modified: developers/werner/ahrt/host/tmc/tty.c
===================================================================
--- developers/werner/ahrt/host/tmc/tty.c 2008-03-15 13:37:29 UTC (rev
4212)
+++ developers/werner/ahrt/host/tmc/tty.c 2008-03-15 21:37:01 UTC (rev
4213)
@@ -29,6 +29,8 @@
struct tty_dsc {
int fd; /* file descriptor */
int crlf; /* 0 = in message, 1 = CR seen, 2 = CRLF seen */
+ int echo; /* device echos commands back */
+ int dci; /* device support DCI */
struct termios attr;
};
@@ -70,9 +72,21 @@
int i;
struct termios attr;
+ d = malloc(sizeof(struct tty_dsc));
+ if (!d) {
+ perror("malloc");
+ return NULL;
+ }
+ d->crlf = 0;
+ d->echo = 0;
+ d->dci = 1;
for (i = 0; i != argc; i++) {
if (!strcmp(argv[i], "crtscts"))
crtscts = 1;
+ else if (!strcmp(argv[i], "echo"))
+ d->echo = 1;
+ else if (!strcmp(argv[i], "no_dci"))
+ d->dci = 0;
else if (!strncmp(argv[i], "bps=", 4)) {
bps = strtoul(argv[i]+4, &end, 0);
if (*end)
@@ -88,12 +102,6 @@
if (i != argc-1)
goto usage;
- d = malloc(sizeof(struct tty_dsc));
- if (!d) {
- perror("malloc");
- return NULL;
- }
- d->crlf = 0;
d->fd = open(argv[i], O_RDWR | O_NOCTTY, 0);
if (d->fd < 0) {
@@ -120,7 +128,9 @@
return d;
usage:
- fprintf(stderr, "usage: \"tty\", [crtscts,] [bps=N,] device\n");
+ fprintf(stderr,
+ "usage: \"tty\", [crtscts,] [bps=N,] [echo,] [no_dci,] device\n");
+ free(d);
return NULL;
fail_fd:
@@ -208,16 +218,12 @@
if (do_write(d->fd, buf, len) < 0)
return -1;
-#if 0
- if (expect(d->fd, buf, len) < 0)
+ if (d->echo && expect(d->fd, buf, len) < 0)
return -1;
-#endif
if (do_write(d->fd, "\r\n", 2) < 0)
return -1;
-#if 0
- if (expect(d->fd, "\r\n", 2) < 0)
+ if (d->echo && expect(d->fd, "\r\n", 2) < 0)
return -1;
-#endif
return 0;
}
@@ -278,7 +284,7 @@
{
struct tty_dsc *d = dsc;
- return do_write(d->fd, "\003", 1);
+ return d->dci ? do_write(d->fd, "\003", 1) : 0;
}
--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog