Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Oct 2017 11:35:41 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        freebsd-questions@freebsd.org
Subject:   one character lag with pyboard over usb serial
Message-ID:  <20171001093541.GA81952@slackbox.erewhon.home>

next in thread | raw e-mail | index | archive | help
Since last week I've been playing with my new pyboard
[https://store.micropython.org/#/products/PYBv1_1]

It is basically a microcontroller board running python 3 as its operating
system. When you plug this in to a computer using USB, it presents itself as
both a mass storage device and a modem.

Output from dmesg for this device:

    ugen2.2: <MicroPython Pyboard Virtual Comm Port in FS Mode> at usbus2
    umass0 on uhub2
    umass0: <MicroPython Pyboard Virtual Comm Port in FS Mode, class 239/2, rev 2.00/2.00,
    addr 2> on usbus2
    umass0:  SCSI over Bulk-Only; quirks = 0x0100
    umass0:3:0: Attached to scbus3
    umodem0 on uhub2
    umodem0: <MicroPython Pyboard Virtual Comm Port in FS Mode, class 239/2, rev 2.00/2.00,
    addr 2> on usbus2
    umodem0: data interface 2, has no CM over data, has no break

Using a program like picocom, you can connect to the modem which presents a
Python Read Eval Print Loop (“REPL”). The REPL works but has one very annoying
problem.

It seems to have a one-character lag. The first character I type on a
line is not directly shown but creates a new line. Only after I type the
second character does the first character becomes visible. Also, any return text
from the board longer than a couple of lines seems to stop halfway, and I have
to type return for it to continue.

I'm using FreeBSD 11.1-STABLE r321626 amd64 with a GENERIC kernel.

This is what I see hen I connect to the board with picocom:

    > ./picocom  -b 115200 /dev/cuaU0
    picocom v2.2

        port is        : /dev/cuaU0
        flowcontrol    : none
        baudrate is    : 115200
        parity is      : none
        databits are   : 8
        stopbits are   : 1
        escape is      : C-a
        local echo is  : no
        noinit is      : no
        noreset is     : no
        nolock is      : no
        send_cmd is    : sz -vv
        receive_cmd is : rz -vv -E
        imap is        : 
        omap is        : 
        emap is        : crcrlf,delbs,

        Type [C-a] [C-h] to see available commands

        Terminal ready
        .2 on 2017-08-23; PYBv1.1 with STM32F405RG
        Type "help()" for more information.

After this, I have to tap the <enter> key to get the familiar Python prompt (“>>>”) to
appear. However, when I e.g. type “help()”, this happens:

    >>>
    >>> help(

The first key <h> creates a new line. The second key <e> makes the “h”
visible. And so on. After typing <)>, typing <enter> makes the last “)”
visible and produces output.

I also tried using “screen”, but that produced the same results as picocom.

The stty output for the port is:

    # stty -af /dev/cuaU0
    speed 115200 baud; 0 rows; 0 columns;
    lflags: -icanon -isig -iexten -echo -echoe -echok echoke -echonl echoctl
        -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
        -extproc
    iflags: -istrip -icrnl -inlcr -igncr -ixon -ixoff -ixany -imaxbel ignbrk
        -brkint -inpck -ignpar -parmrk
    oflags: -opost onlcr -ocrnl tab0 -onocr -onlret
    cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
        -dtrflow -mdmbuf
    cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U;
        lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
        status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;

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.

Can anyone suggest a fix for this issue?

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?20171001093541.GA81952>