Date: Sun, 1 Oct 2017 15:59:21 +0200 From: Roland Smith <rsmith@xs4all.nl> To: Polytropon <freebsd@edvax.de>, freebsd-questions@freebsd.org Subject: Re: one character lag with pyboard over usb serial Message-ID: <20171001135921.GA87960@slackbox.erewhon.home> In-Reply-To: <20171001113308.GA82813@slackbox.erewhon.home> References: <20171001093541.GA81952@slackbox.erewhon.home> <20171001122009.3fbfbf95.freebsd@edvax.de> <20171001113308.GA82813@slackbox.erewhon.home>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 01, 2017 at 01:33:08PM +0200, Roland Smith wrote: > On Sun, Oct 01, 2017 at 12:20:09PM +0200, Polytropon wrote: > > On Sun, 1 Oct 2017 11:35:41 +0200, Roland Smith wrote: > > > I've asked around on the pyboard forum, but nobody there (using Linux or OSX) > > > has seen this problem. It has been suggested that this is a FreeBSD driver > > > problem. > > > > Try to verify with the "cu" program provided natively by the OS. > > With ‘cu’, I see the same problem. :-( > > > In worst case, monitor the /dev/cuaU-1 device file directly to > > check what is really being sent in either direction. If the > > lag also appears there, it really looks like a driver issue... > Thanks to http://mmdolze.users.sourceforge.net/serial-port-monitoring.html, I found a good way to use picocom and socat. I used comms/picocom for communication and net/socat in a different terminal to capture the data. # socat -d -v -x PTY,link=/tmp/serial,wait-slave,rawer /dev/cuaU0,rawer > & socat.txt # picocom /tmp/serial Note that, inspired by the manual page, I used the “rawer” option rather than the “raw” option seen in the link above. Here are the contents of socat.txt. Data from the board is preceded by “<”, what I type is preceded by “>” < 2017/10/01 15:37:57.488955 length=48 from=0 to=47 2e 32 20 6f 6e 20 32 30 31 37 2d 30 38 2d 32 33 .2 on 2017-08-23 3b 20 50 59 42 76 31 2e 31 20 77 69 74 68 20 53 ; PYBv1.1 with S 54 4d 33 32 46 34 30 35 52 47 0d 0a TM32F405RG.. 54 79 70 65 Type -- I typed <enter> below because more text was not forecoming. As per the reactions from the pyboard forum, this is as expected. > 2017/10/01 15:38:01.181435 length=1 from=0 to=0 0d . -- < 2017/10/01 15:38:01.247992 length=37 from=48 to=84 20 22 68 65 6c 70 28 29 22 20 66 6f 72 20 6d 6f "help()" for mo 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0d re information.. 0a . 3e 3e 3e 20 >>> -- > 2017/10/01 15:38:05.413958 length=1 from=1 to=1 68 h -- Here the weirdness begins. There is a carriage return/newline pair here followed by a new prompt that basically shouldn't be here. < 2017/10/01 15:38:05.416064 length=6 from=85 to=90 0d 0a .. 3e 3e 3e 20 >>> -- > 2017/10/01 15:38:06.290046 length=1 from=2 to=2 65 e -- < 2017/10/01 15:38:06.292079 length=1 from=91 to=91 68 h -- > 2017/10/01 15:38:06.579576 length=1 from=3 to=3 6c l -- < 2017/10/01 15:38:06.581082 length=1 from=92 to=92 65 e -- > 2017/10/01 15:38:06.816570 length=1 from=4 to=4 70 p -- < 2017/10/01 15:38:06.818083 length=1 from=93 to=93 6c l -- > 2017/10/01 15:38:07.786224 length=1 from=5 to=5 28 ( -- < 2017/10/01 15:38:07.788107 length=1 from=94 to=94 70 p -- > 2017/10/01 15:38:07.884016 length=1 from=6 to=6 29 ) -- < 2017/10/01 15:38:07.886107 length=1 from=95 to=95 28 ( -- > 2017/10/01 15:38:08.824194 length=1 from=7 to=7 0d . -- < 2017/10/01 15:38:08.826122 length=1 from=96 to=96 29 ) -- < 2017/10/01 15:38:08.829134 length=521 from=97 to=617 0d 0a .. 57 65 6c 63 6f 6d 65 20 74 6f 20 4d 69 63 72 6f Welcome to Micro 50 79 74 68 6f 6e 21 0d 0a Python!.. 0d 0a .. 46 6f 72 20 6f 6e 6c 69 6e 65 20 68 65 6c 70 20 For online help 70 6c 65 61 73 65 20 76 69 73 69 74 20 68 74 74 please visit htt 70 3a 2f 2f 6d 69 63 72 6f 70 79 74 68 6f 6e 2e p://micropython. 6f 72 67 2f 68 65 6c 70 2f 2e 0d 0a org/help/... 0d 0a .. 51 75 69 63 6b 20 6f 76 65 72 76 69 65 77 20 6f Quick overview o 66 20 63 6f 6d 6d 61 6e 64 73 20 66 6f 72 20 74 f commands for t 68 65 20 62 6f 61 72 64 3a 0d 0a he board:.. 20 20 70 79 62 2e 69 6e 66 6f 28 29 20 20 20 20 pyb.info() 2d 2d 20 70 72 69 6e 74 20 73 6f 6d 65 20 67 65 -- print some ge 6e 65 72 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f neral informatio 6e 0d 0a n.. 20 20 70 79 62 2e 64 65 6c 61 79 28 6e 29 20 20 pyb.delay(n) 2d 2d 20 77 61 69 74 20 66 6f 72 20 6e 20 6d 69 -- wait for n mi 6c 6c 69 73 65 63 6f 6e 64 73 0d 0a lliseconds.. 20 20 70 79 62 2e 6d 69 6c 6c 69 73 28 29 20 20 pyb.millis() 2d 2d 20 67 65 74 20 6e 75 6d 62 65 72 20 6f 66 -- get number of 20 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 20 73 69 milliseconds si 6e 63 65 20 68 61 72 64 20 72 65 73 65 74 0d 0a nce hard reset.. 20 20 70 79 62 2e 53 77 69 74 63 68 28 29 20 20 pyb.Switch() 2d 2d 20 63 72 65 61 74 65 20 61 20 73 77 69 74 -- create a swit 63 68 20 6f 62 6a 65 63 74 0d 0a ch object.. 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 77 69 74 63 68 20 6d 65 74 68 6f 64 Switch method 73 3a 20 28 29 2c 20 63 61 6c 6c 62 61 63 6b 28 s: (), callback( 66 29 0d 0a f).. 20 20 70 79 62 2e 4c 45 44 28 6e 29 20 20 20 20 pyb.LED(n) 2d 2d 20 63 72 65 61 74 65 20 61 6e 20 4c 45 44 -- create an LED 20 6f 62 6a 65 63 74 20 66 6f 72 20 4c 45 44 20 object for LED 6e 20 28 6e 3d 31 2c 32 2c 33 2c 34 29 0d 0a n (n=1,2,3,4).. 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4c 45 44 20 6d 65 74 68 6f 64 73 3a 20 LED methods: 6f 6e 28 29 2c 20 6f 66 66 28 29 2c 20 74 6f 67 on(), off(), tog 67 6c 65 28 29 2c 20 69 6e 74 65 6e 73 69 74 79 gle(), intensity 28 3c 6e 3e 29 0d (<n>). -- < 2017/10/01 15:38:08.832279 length=128 from=618 to=745 0a . 20 20 70 79 62 2e 50 69 6e 28 70 69 6e 29 20 20 pyb.Pin(pin) 2d 2d 20 67 65 74 20 61 20 70 69 6e 2c 20 65 67 -- get a pin, eg 20 70 79 62 2e 50 69 6e 28 27 58 31 27 29 0d 0a pyb.Pin('X1').. 20 20 70 79 62 2e 50 69 6e 28 70 69 6e 2c 20 6d pyb.Pin(pin, m 2c 20 5b 70 5d 29 20 2d 2d 20 67 65 74 20 61 20 , [p]) -- get a 70 69 6e 20 61 6e 64 20 63 6f 6e 66 69 67 75 72 pin and configur 65 20 69 74 20 66 6f 72 20 49 4f 20 6d 6f 64 65 e it for IO mode 20 6d 2c 20 70 75 6c 6c 20 6d 6f 64 65 20 70 m, pull mode p -- > 2017/10/01 15:38:10.363393 length=1 from=8 to=8 0d . -- Roland -- R.F.Smith http://rsmith.home.xs4all.nl/ [plain text email much appreciated]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171001135921.GA87960>