Can't get loopback serial communication to work

Big picture: ultimately, what I’m trying to do is use my La Frite as a way to read serial logging data from my wiiu. But this post isn’t about that. I’m trying to verify the cable I bought actually works, and not having any luck. This post is about distinguishing between “you’re doing it wrong” and “the cable doesn’t work”.

Hardware involved:

  • La Frite 1GB board w/ 8GB eMMC
  • USB-to-serial cable with FT232RL, 3.3v logic levels. This cable is USB-A on one end and 3 1-pin connectors (for GND, TXD, and RXD) on the other. (amazon link: Amazon.com)

Software involved:

  • Armbian 22.11.1
  • minicom

Steps I’ve taken:

  1. add overlays=uartA to /boot/armbianEnv.txt to enable UART A (/dev/ttyAML6)
  2. connect the cable as follows:
  • GND → pin 6
  • TXD → pin 10
  • RXD → pin 8
  • USB → one of the USB ports (I’ve tried both)
  1. run minicom --baudrate 57600 --device /dev/ttyUSB0 -8 in one session
  2. run minicom --baudrate 57600 --device /dev/ttyAML6 -8 in another session

After doing this, I expect to be able to type in one minicom session and see the text in the other. However, if I type “hello” and press enter, I see nothing.

Am I doing something wrong?

My La Frite isn’t in-hand yet, but a couple small things to check (and forgive me if you already have):

Verify the name of the serial device you’re trying to use is the right one – dmesg and ls -alrt /dev/tty* and ls -alrt /dev/serial* might show something different than what you’re expecting.
Does the user you’re using have permissions to the devices?
Could you go one step simpler and do a pure loopback test (jumper RX directly to TX) to test one “side” at a time?

sure.

Some additional details:

$ uname -a
Linux lafrite 6.0.13-meson64 #22.11.2 SMP PREEMPT Sun Dec 18 16:52:19 CET 2022 aarch64 aarch64 aarch64 GNU/Linux

I’m pretty confident the devices are correct. Here’s the dmesg output for the FTDI adapter from when the USB end of the cable is attached:

[  330.376285] ftdi_sio 1-2:1.0: FTDI USB Serial Device converter detected
[  330.376580] usb 1-2: Detected FT232RL
[  330.378398] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0

For the other end, /dev/ttyAML6 didn’t exist until I adapted these steps:

I say “adapted” because I wasn’t able to use the libretech wiring tool to install the DTO. but Armbian provides (or at least seems to provide) the same functionality via the overlays= directive in armbianEnv.txt.

Also, permissions look good. Both devices are r/w for the dialout group and my armbian user belongs to that group.

I’ll try shorting TX to RX and see what happens.

Okay, so jumpering the USB cable’s TX/RX together works, so I’m at least reasonably confident that the cable is good.

That means either the UART is shot, or is not actually getting activated correctly by Armbian.

I think my next step will be to replace Armbian with a distro that the Libretech Wiring Tool supports and see if I have better luck enabling UART A.

Cool – glad to hear you had some successful progress.

Might be worth trying bringing that stty -F ... baudrate down if you haven’t already (did you match it to what you were using as the argument to minicom)?

I believe @librecomputer has mentioned elsewhere that Armbian support can be a little sketchy because they don’t have as much control over it. I’ve had good luck with the Libre-provided Ubuntu images, but since La Frite has lower specs (memory, especially), that might be a constraint. I think they’ve said that the full “desktop” image is too heavy.

Sounds like you’re on the right path, though.

The short version is: installing the libre ubuntu and using the libretech wiring tool did the trick.

I’ll post the long version for posterity and to help anyone else trying to install Ubuntu onto the eMMC via a Mac.

First, I tried flashing the Ubuntu image onto a USB drive and booting from it. This ended up being a pretty big waste of time, for a few reasons:

  • The USB I/O was really slow
  • The Libre images are pre-installed, which means there’s no simple way to transfer the Ubuntu install from the USB stick onto the eMMC
  • Part of my problem was the USB stick itself, a 128GB drive made by “onn”, which apparently draws too much power and caused error “read/64, -110” which is apparently Linux Kernel-ese for “too much power draw.”

Now, the technique I finally used to install the Ubuntu image only works if the La Frite firmware is up-to-date, so do that first.

Installation steps:

  1. format the USB stick for FAT32
  2. download the image onto the stick
  3. Plug the USB stick and a keyboard into the La Frite, and connect the HDMI to a display
  4. Power on the La Frite, and as soon as the keyboard gets power start tapping the escape key.
  5. From the boot menu, select the EtherealOS option. (note, some keyboards may act funny navigating the menu; if this happens for you, tap the CTRL key after pressing the arrow key)
  6. Once ethearealOS is booted, run the following commands:
    mount /dev/sda1 /media
    dd if=/media/<ubuntu image filename> of=/dev/mmcblk0 bs=512
    reboot
    

La Frite should start booting off eMMC and load Ubuntu.

After I did this and ran the commands in the document linked in the OP, my loopback test was successful.

1 Like

The reason for these shenanigans is that the USB block mode does not get picked up by Mac OS. I’m not sure if it’s a MacOS bug, or a La Frite firmware bug.

The u-boot eMMC flashing is for people who cannot dd in Linux. Best and fastest just to boot Linux and dd the image to /dev/mmcblk0.