Yrrah
July 5, 2023, 2:54pm
1
Hello,
I have a BBB that was running my application perfectly for several years. Stupid me, after I was done with my application latest version (to distribute on uSD card) I did some apt-get upgrade/update. Now my UART stopped working. Error code: Set pin mode failed for UART channel. I tried a fresh installation with Debian 2019-08-03 but that gives the same error. Something must have changed,but what? Please help me get things going again.
Running Python3 and Adafruit lib.
Thanks a lot.
Kind regards,
Yrrah
What pins/uart are you trying to use? (what command did you previously use to configure them.)…
Please run, sudo /opt/scripts/tools/version.sh
to help debugging…
Regards,
Yrrah
July 6, 2023, 9:12am
3
Hello Robert,
The version.sh info:
debian@beaglebone:/opt/scripts/tools$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[109f74fb87e6034ae1a8971a244064a8d5e090a5]
eeprom:[A335BNLT00C03919BBBK0053]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2019-08-03]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-gbb4af0f50f]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2017.03-00002-gd12b1519b4]:[location: dd MBR]
kernel:[4.14.108-ti-r113]
nodejs:[v6.17.0]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20190801.0-0rcnee0~stretch+20190801]
pkg:[bb-wl18xx-firmware]:[1.20190227.1-0rcnee0~stretch+20190227]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~stretch+20190327]
pkg:[firmware-ti-connectivity]:[20180825+dfsg-1rcnee1~stretch+20181217]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev gpio pwm eqep remoteproc admin spi tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 1.199208] remoteproc remoteproc0: wkup_m3 is available
[ 1.276700] remoteproc remoteproc0: powering up wkup_m3
[ 1.276819] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[ 1.280880] remoteproc remoteproc0: remote processor wkup_m3 is now up
dmesg | grep pru
dmesg | grep pinctrl-single
[ 0.873753] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 0.874965] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 002: ID 1ea7:0066
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END
debian@beaglebone:/opt/scripts/tools$
Since years I use:
import serial
import Adafruit_BBIO.UART as UART
UART.setup(“UART2”) # or 4, I need both
ser2=serial.Serial(port=“/dev/ttyS2”)
Hope you can help me out.
KR,
Harke
I don’t think the Adafruit library is maintained any more and has issues with newer kernels.
If the UART is configured correctly by an overlay, you won’t need to use the Adafruit library, just use the Python serial library directly.
If you have something like minicom installed on the BB you can try opening the serial ports directly using that, just to verify that they are working.
Yrrah
July 6, 2023, 10:00am
5
Hello Benedict,
I am not quite sure what you mean.
…~$config-pin -q p9.22 gives: pinmux file not found
p9.22 is uart.
Please advise.
KR,
Harke
If you use the correct overlay it will configure the correct pin muxing for you
you don’t need to use config-pin.
ok so you mentioned UART2.
P9.21 & P9.22
It looks like there are 2 overlays that configure UART2.
BB-UART2-00A0.dtbo
BB-UART2-00A1.dtbo
Both basically the same, written by 2 different groups.
if you edit /boot/uEnv.txt and scroll down to the section that starts
###Additional custom capes
#uboot_overlay_addr4=<file4>.dtbo
#uboot_overlay_addr5=<file5>.dtbo
#uboot_overlay_addr6=<file6>.dtbo
#uboot_overlay_addr7=<file7>.dtbo
In the above change the first two overlays to read
uboot_overlay_addr4=BB-UART2-00A0.dtbo
uboot_overlay_addr5=BB-UART4-00A0.dtbo
After reboot.
That should enable UARTS 2 and 4 and configure the correct pin muxing for those ports. P9.21 & P9.22 for UART2 and P9.13 & P9.11 for UART4
They should then be accessible to anything the can read/write the correct dev port.
Of course also check the user/group permissions of the /dev file to make sure whichever user you are running as, belongs to the same group.
(edit by rcn-ee, removed /lib/firmware/*)
Yrrah
July 6, 2023, 10:56am
9
Thank you for your time.
I did as advised but no change at all. uEnv.txt is correctly changed.
How to proceed?
Ok so just tested this in my BBB.
The version I am running is Debian Buster IoT Image 2020-04-06
Kernel is 4.19.94-ti-r42
Loaded the above overlays and rebooted.
Connected a TTL serial interface to P9.21 & P9.22 and can transmit and receive perfectly ok using minicom to my laptop.
Can you hook up a serial cable to the console output and check to see if uboot is actually loading the overlays ?
Also check to make sure uboot overlays are enabled. I think they are by default.
###Master Enable
enable_uboot_overlays=1
###
The version of u-boot installed in your eMMC, will not support u-boot overlays. If you don’t use the eMMC, just erase it with dd…
Our version of Debian 9.x (Stretch), didn’t have a u-boot package to easily didn’t have a way to upgrade. (I didn’t create that package till Debian 10.x (Buster)).
So, unless you are attached to an ancient image, just upgrade to Debian 10.x or Debian 11.x first…
https://forum.beagleboard.org/tag/latest-images
Regards,
Yrrah
July 6, 2023, 12:47pm
12
I do not understand. Everything worked fine for years and a couple of days ago: no serial IO anymore. I tried: sudo config-pin -q p9.22. A correctly configured pin should give something like UART? I get: P9_22 pinmux file not found. Can not read pinmux file. I use an attached (grafics) and usb keyboard, like always. I can connect something to the UARTs but it does not make sense at this point. What to do?
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-gbb4af0f50f]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2017.03-00002-gd12b1519b4]:[location: dd MBR]
What did you do a couple days ago? That version 2017.03-00002 of u-boot didn’t magically install it self…
If you aren’t using the eMMC, just run:
edit:
sudo dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=100
Regards,
Yrrah
July 6, 2023, 12:56pm
14
I’m afraid I did: sudo apt-get upgrade/update…
Flashing Debian 10…
Yrrah
July 6, 2023, 12:59pm
15
Flashing to a uSD card. Do not use eMMC anymore
Debian 9.x (Stretch) archive has been closed for a year, apt update/upgrade should not have installed anything… (We also don’t auto install u-boot thru apt, so the files in MBR would not have been upgraded)…
Regards,
Since you are using the uSD, make sure you also erase the eMMC. Such that u-boot in the eMMC doesn’t cause endless issues…
Regards,
Yrrah
July 6, 2023, 1:08pm
18
Have nothing against eMMc but it was too small???
That’s perfectly fine…
The issue, boot rom scans for u-boot in this order:
eMMC
microSD
So just run:
edit:
sudo dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=100
So that only the microSD’s version of u-boot is used on bootup, so overlays work…
Regards,
Yrrah
July 6, 2023, 1:19pm
20
OK Debian 10 is up and running. Try the dd command but the "size"operand is not recognized.