(gnu) stty limitation?

The (gnu) stty program is part of the official repository:

root@jwd2:~# opkg list | grep stty
coreutils-stty - 8.16-1 - Full version of standard GNU stty utility. Normally, you would not use this package, since the functionality in BusyBox is more than sufficient.

The comment is a bit misleading because the BusyBox implementation doesn’t have an stty functionality (as far as I know); also, on boot time the uart is set to 250000 baud;

dmesg | grep ttyATH0
[    0.000000] Kernel command line:  board=Yun console=ttyATH0,250000 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd

Now run ‘stty -F /dev/ttyATH0’; gnu stty reports a baudrate of 230400; even if you explicitly try to set it to 250000 baud (which is was already set to).

It isn’t much of a problem because I want to run that serial bus as fast as possible (250000BD?) but it this a limitation of the gnu implementation of stty?

kind regards,

Jos

busybox
Currently defined functions:
        [, [[, arping, ash, awk, basename, brctl, bunzip2, bzcat, cat, chgrp, chmod, chown, chroot, clear, cmp, cp, crond,
        crontab, cut, date, dd, df, dirname, dmesg, dnsdomainname, du, echo, egrep, env, expr, false, fgrep, find, free,
        fsync, grep, gunzip, gzip, halt, head, hexdump, hostid, hostname, hwclock, id, ifconfig, init, insmod, kill, killall,
        klogd, less, ln, lock, logger, logread, ls, lsmod, lsusb, md5sum, mkdir, mkfifo, mknod, mkswap, mktemp, mount, mv,
        nc, netmsg, netstat, nice, nslookup, ntpd, passwd, pgrep, pidof, ping, ping6, pivot_root, poweroff, printf, ps, pwd,
        readlink, reboot, reset, rm, rmdir, rmmod, route, sed, seq, sh, sleep, sort, start-stop-daemon, strings, swapoff,
        swapon, switch_root, sync, sysctl, syslogd, tail, tar, tee, telnet, test, time, top, touch, tr, traceroute, true,
        udhcpc, umount, uname, uniq, uptime, vconfig, vi, watchdog, wc, which, xargs, yes, zcat

The busybox is coming with Yun has no stty build in.

sonnyyu:
The busybox is coming with Yun has no stty build in.

Yep, I know, that’s why I installed GNU’s version, but it can’t set the baudrate to 250000 baud (or anything not a multiple of 300?)

kind regards,

Jos

Use termios2 API in Linux , will be enable arbitrary-baud

Download arbitrary-baud here:

 ./arbitrary-baud /dev/ttyATH0  250000
actual speed reported 250000

Now we could use arbitrary-baud to setup arbitrary speed, but to make pySerial use arbitrary speed we need pySerial at least version 2.7, The Yun-Openwrt come with version 2.4.

We could use Plan B-D

to install version 2.7 of pySerial.