pyserial stopped working after Debian update?

Learned group,

Recently I updated (flashed) my Debian version from 2015-11-12 to Debian 2017-01-22. The hw rest unchanged: BBB, 4D systems display and a universal board only to interface a simple N8M GPS receiver. I have a very simple Python script to read UART2 connected to the GPS receiver and show some lines of NMEA. In the old Debian version this (and my other applications) work good. At first the display did not work either, but I found I had to uncomment a line in uEnv.txt. The gui apparently has been changed… So far so good. I also did: sudo apt-get update and installed Adafruit and pyserial, if necessary. Now my old script does not work anymore. It leaves me with error; Errno 2: could not open port /dev/ttyO2. No such file or directory. Do I miss something here? What else do I need to do?
Please advise.
Thanks in advance,
Harke

On Sun, 29 Jan 2017 03:17:51 -0800 (PST), Harke Smits
<yrrah53@gmail.com> declaimed the following:

pyserial, if necessary. Now my old script does not work anymore. It leaves
me with error; Errno 2: could not open port /dev/ttyO2. No such file or
directory. Do I miss something here? What else do I need to do?

  Well, first thing: do you HAVE a ttyO2 in /dev? I don't -- using a
"Wheezy" image from last summer, I'll dig up the SD card with "Jessie" in a
moment... (apologies for the bad wrapping)

debian@beaglebone:~$ uname -a
Linux beaglebone 3.8.13-bone80 #1 SMP Wed Jun 15 17:03:55 UTC 2016 armv7l
GNU/Linux
debian@beaglebone:~$ ls /dev/tty*
/dev/tty /dev/tty16 /dev/tty24 /dev/tty32 /dev/tty40 /dev/tty49
/dev/tty57 /dev/tty8
/dev/tty0 /dev/tty17 /dev/tty25 /dev/tty33 /dev/tty41 /dev/tty5
/dev/tty58 /dev/tty9
/dev/tty1 /dev/tty18 /dev/tty26 /dev/tty34 /dev/tty42 /dev/tty50
/dev/tty59 /dev/ttyGS0
/dev/tty10 /dev/tty19 /dev/tty27 /dev/tty35 /dev/tty43 /dev/tty51
/dev/tty6 /dev/ttyO0
/dev/tty11 /dev/tty2 /dev/tty28 /dev/tty36 /dev/tty44 /dev/tty52
/dev/tty60 /dev/ttyS0
/dev/tty12 /dev/tty20 /dev/tty29 /dev/tty37 /dev/tty45 /dev/tty53
/dev/tty61 /dev/ttyS1
/dev/tty13 /dev/tty21 /dev/tty3 /dev/tty38 /dev/tty46 /dev/tty54
/dev/tty62 /dev/ttyS2
/dev/tty14 /dev/tty22 /dev/tty30 /dev/tty39 /dev/tty47 /dev/tty55
/dev/tty63 /dev/ttyS3
/dev/tty15 /dev/tty23 /dev/tty31 /dev/tty4 /dev/tty48 /dev/tty56
/dev/tty7
debian@beaglebone:~$

  I show ttyS0 .. ttyS3

debian@beaglebone:~$ uname -a
Linux beaglebone 4.4.30-ti-r64 #1 SMP Fri Nov 4 21:23:33 UTC 2016 armv7l
GNU/Linux
debian@beaglebone:~$ ls /dev/tty*
/dev/tty /dev/tty17 /dev/tty26 /dev/tty35 /dev/tty44 /dev/tty53
/dev/tty62 /dev/ttyS0
/dev/tty0 /dev/tty18 /dev/tty27 /dev/tty36 /dev/tty45 /dev/tty54
/dev/tty63 /dev/ttyS1
/dev/tty1 /dev/tty19 /dev/tty28 /dev/tty37 /dev/tty46 /dev/tty55
/dev/tty7 /dev/ttyS2
/dev/tty10 /dev/tty2 /dev/tty29 /dev/tty38 /dev/tty47 /dev/tty56
/dev/tty8 /dev/ttyS3
/dev/tty11 /dev/tty20 /dev/tty3 /dev/tty39 /dev/tty48 /dev/tty57
/dev/tty9 /dev/ttyS4
/dev/tty12 /dev/tty21 /dev/tty30 /dev/tty4 /dev/tty49 /dev/tty58
/dev/ttyGS0 /dev/ttyS5
/dev/tty13 /dev/tty22 /dev/tty31 /dev/tty40 /dev/tty5 /dev/tty59
/dev/ttyO0
/dev/tty14 /dev/tty23 /dev/tty32 /dev/tty41 /dev/tty50 /dev/tty6
/dev/ttyO1
/dev/tty15 /dev/tty24 /dev/tty33 /dev/tty42 /dev/tty51 /dev/tty60
/dev/ttyO2
/dev/tty16 /dev/tty25 /dev/tty34 /dev/tty43 /dev/tty52 /dev/tty61
/dev/ttyO4
debian@beaglebone:~$

  Interesting -- Jessie (from last fall) shows both ttyO0/1/2/4 AND
ttyS0/1/2/3/4/5

debian@beaglebone:~$ ls -l /dev/ttyO*
lrwxrwxrwx 1 root root 5 Dec 10 12:31 /dev/ttyO0 -> ttyS0
lrwxrwxrwx 1 root root 5 Jan 29 10:57 /dev/ttyO1 -> ttyS1
lrwxrwxrwx 1 root root 5 Jan 29 10:57 /dev/ttyO2 -> ttyS2
lrwxrwxrwx 1 root root 5 Jan 29 10:57 /dev/ttyO4 -> ttyS4
debian@beaglebone:~$ ls -l /dev/ttyS*
crw--w---- 1 root tty 4, 64 Dec 10 12:32 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Jan 29 10:57 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 Jan 29 10:57 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Dec 10 12:32 /dev/ttyS3
crw-rw---- 1 root dialout 4, 68 Jan 29 10:57 /dev/ttyS4
crw-rw---- 1 root dialout 4, 69 Dec 10 12:32 /dev/ttyS5

Though the ttyO* are just links to the ttyS*

  Maybe in a month or so I'll have time to flash the eMMC up to Jessie,
and set the SD cards to newer releases. (I prefer to keep the eMMC on an
older working config)

Hello Dennis,

That is a very relevant reaction! Thanks a lot! Now I have to find out what port is connected with UART 2 (and others I need…). I found ttyO0 and ttyO3 working, i.e. no errors reported. But also no idea to what UART they are connected. Definitely not UART2, I am using.
Apart from the fact that I cannot believe that someone deliberately messed up with the serial ports… Compatibility with earlier scripts is completely gone!
Can anyone supply me with the altest UART mapping? Or better yet: re-install the old mapping?
Cheers!
Harke

Well, userspace changed from: /dev/ttyOx -> /dev/ttySx, by default we
have a udev rule setup to allow you to use /dev/ttyOx

However if you are loading a device tree overlay from the 3.8.13 era,
you need to update the device tree node name.

for example usart 2: (today)

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-UART2-00A0.dts#L47

usart2 (yesterday with 3.8.13)

https://github.com/beagleboard/linux/blob/3.8/firmware/capes/BB-UART2-00A0.dts#L41

As you might have other issues causing the blockage, please add the output off

dmesg | grep bone

Regards,

Hello Robert,

Thanks for your reaction. I understand /dev/ttyOx has been replaced by /dev/ttySx (x from 0-5). However the rest is far beyond my level of skill. I do not know what dt overlay I load. I just flashed the latest Debian version. And then updated all (sudo apt-get update). I do not understand C, just a bit of Python. I need to use the UARTs 2 and 4. and of course a number of I/O bits. I hope that is still the same? I can and are prepared to move to the latest versions, just need to know what to do…
Regards,
Harke

btw, you can also just do:

cd /opt/scripts/tools/
git pull
sudo ./update_kernel.sh --bone-channel --stable
sudo reboot

and then you can return to the classic 3.8.13 based kernel you are use too..

Regards,

Unfortunately that crashes the system… all four blue leds on…
I will try and reflash from mem card.
H

I repeated everything: same problem. BBB does not boot anymore!? Did I do something wrong here?
Please advise, regards,
Harke

OK I got it working manually;

Fist:

debian@beaglebone:~$ cat /sys/devices/platform/bone_capemgr/slots
 0: PF----  -1 4D cape display variables
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1

Than:

sudo sh -c "echo 'BB-UART2' > /sys/devices/platform/bone_capemgr/slots"

Again:

debian@beaglebone:~$ cat /sys/devices/platform/bone_capemgr/slots
 0: PF----  -1 etc...
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1
 4: P-O-L-   0 Override Board Name,00A0,Override Manuf,BB-UART2

My testscript using UART2 now works. However, after a reboot all needs to be done again. Not very satisfactory.

How can I get it installed on boot?
Please advise!
Regards,
Harke

open /boot/uEnv.txt

cape_enable=bone_capemgr.enable_partno=BB-UART2

Regards,

Thanks Robert,

Now it works. I modified uEnv.txt at two places; one for the display to work end another for the UART’s to work.
Back to the application.
Regards,
Harke