How to stop the serial login console before a Fomu UART test

You want the Fomu EVT’s UART test to own /dev/serial0.

The Pi’s login console holds it; the wires are on Fomu EVT wiring to a Raspberry Pi.

What you need

  • A Raspberry Pi with the Fomu EVT on its GPIO header and a GPIO UART at /dev/serial0.

  • sudo rights on the Pi.

Steps

  1. On the Pi, stop early if there is no GPIO UART here. Otherwise the lookup in step 2 resolves to nothing, and the mask silently targets the wrong unit.

$ [ -e /dev/serial0 ] || { echo "no GPIO UART on this host"; exit 1; }
  1. In the same shell, resolve serial0 to the real device; this works whether the GPIO UART is the PL011 (ttyAMA0) or the mini UART (ttyS0).

$ GETTY="serial-getty@$(basename "$(readlink -f /dev/serial0)").service"
  1. Mask the unit, which prevents systemd from restarting the serial login console.

$ sudo systemctl mask "$GETTY"
  1. Stop the instance that is running.

$ sudo systemctl stop "$GETTY"
  1. Kill any remaining process holding the port.

$ sudo fuser -k /dev/serial0
  1. Fix the permissions after serial-getty releases the device.

$ sudo chmod 666 /dev/serial0
  1. With the Fomu in its DFU bootloader (lsusb lists 1209:5bf0), run the UART test. It loads the UART echo design, then opens /dev/serial0 at 115200 baud. It is the check’s uart test, described on the page under Next.

The UART echo design has no USB core, so after the test the Fomu is off USB. The second command puts foboot back for the next load: it resets the Fomu through the header and waits for 1209:5bf0 on USB.

$ sudo fpgas-fomu-debug test uart
$ sudo fpgas-fomu-debug reset

Check

  • Each command returns without an error.

  • The UART test reads its echo from the design on /dev/serial0.

  • After fpgas-fomu-debug reset, lsusb lists 1209:5bf0 again.

If it fails

What you see

Likely cause

Fix

no GPIO UART on this host

/dev/serial0 does not exist on this Pi

Run the test on a Pi that has the GPIO UART

The test cannot load the design; lsusb does not list 1209:5bf0

The Fomu is out of its DFU bootloader

Fomu EVT programming faults

fpgas-fomu-debug reset: fail: foboot (1209:5bf0) did not come back on USB within 10 s

The reset through the header did not restart foboot

Ask the site operator, then power-cycle the Fomu’s host. Then check that lsusb lists 1209:5bf0

fpgas-fomu-debug reset: error: the closing reset could not be done

The Pi could not drive the Fomu’s header: the host is not a Raspberry Pi, the header read failed, or a header line was left an output

Ask the site operator, then power-cycle the Fomu’s host. Then check that lsusb lists 1209:5bf0

The test reads nothing, or the output is corrupt

The login console came back and consumes the serial data: serial-getty was stopped but not masked

Run the block again; the mask line keeps systemd from restarting it

Next