Enabling Serial / UART on Raspberry pi 3B

  • I'm stumped, I've done this many times on my Pi with different distro's, but can not get Serial communication working on LibreELEC. I'm trying to access a serial device over pins 8 & 10, but get nothing, connection always fails.

    What I've tried:

    enable_uart=1 in config.txt, plus making sure no serial console is enabled (there is none by default). (this is what raspi-config would do if it could be installed on LE)

    I've tried accessing over /dev/ttyS0 and dev/serial0. It seems like bluetooth is working on /dev/ttyAMA0, so I can open a serial connection to that, but it's not what I'm after.

    I have a plugin that tests this, it writes logs, and what i get is "Could not configure port: (5, 'Input/output error')", pretty much exactly what a "cat" command from terminal gives me.

    Any help, please? I've been googling for hours and there is no info for LibreELEC on this issue at all!

    Edit:

    Just found out enable_uart=1 kills the bluetooth, LibreELEC Configuration actually freezes the whole system when i go to the bluetooth tab, removing it from my config.txt makes it work again. Seems like a conflict between overlays or something?

    Edited once, last by xoliul (December 16, 2018 at 9:25 PM).

  • That setting is not in my config.txt, no. Should it be on or off? Mind explaining how i2c affects uart ? Turning it on seems to have no effect.

    edit: if it matters, I have an IQaudio DAC on the Pi, it works, though no overlays were or are enabled in config.txt because or for it.

  • The serial UART handling on the Pi 3B and 3B+ (and Zero W) changed compared to previous models to allow for the internal Bluetooth.

    If the OP has previously enabled it on a Pi2 or lower then there is a change.

    I have found this pi 3 - How do I make serial work on the Raspberry Pi3 , Pi3B+, PiZeroW - Raspberry Pi Stack Exchange :

  • Hey guys,

    thanks for the remarks:

    no, my IQaudio DAC does not use the TXD and RXD pins (Pi-DigiAMP+ at Raspberry Pi GPIO Pinout).

    And yes I understand the whole PL011 vs Mini UART thing, though i can't get anything but bluetooth over PL011 working No, I didn't have a Rpi 2 before this though, only ever did a fresh image on my Rpi 3.

    In general it seems LibreELEC does some non-standard things with the pins and overlays: every distro i tried so far would set most/all pins to LOW when shutting down, but LE keeps them at the state they were when powered on for example. It seems the ports are not configured as you'd expect when setting enable_uart=1; it does create /dev/ttyS0, but it doesn't allow connections. Setting the pi3-disable-bt overlay does not do anythign either, plus it's not an option for me as I want bluetooth as well (and my serial comms can be on the inferior Mini UART for all i care).

    Oh and to add: I had all this working on the same hardware with Raspbian and Volumio, the only difference is the distro I'm using.

  • I think LibreELEC uses a different kernel (compared to Raspbian), which makes UART trouble. UART0 (ttyAMA0) with the LibreELEC kernel is now used by Bluetooth, as you already found out.

    There is "full UART" and "mini UART". You want to use "full UART". This should switch Bluetooth to "mini UART":

    Code
    dtoverlay=pi3-miniuart-bt
  • Can you test if this build works: libreelec-rpi2.arm-9.0-devel-20181217124947-c8d99e0.tar

    We were missing the driver for the miniuart in the RPi kernels - probably noone noticed that until now as most people only used the pl011 UART (I also usually just disable BT to get a full serial console).

    I did a quick test with this build, with an IQaudio DAC board installed on an RPi3B and console=ttyS0,115200 worked with it (that didn't work before).

    so long,

    Hias

  • I think LibreELEC uses a different kernel (compared to Raspbian), which makes UART trouble. UART0 (ttyAMA0) with the LibreELEC kernel is now used by Bluetooth, as you already found out.

    There is "full UART" and "mini UART". You want to use "full UART". This should switch Bluetooth to "mini UART":

    Code
    dtoverlay=pi3-miniuart-bt

    Bingo! That makes /dev/serial0 and /dev/ttyAMA0 connected to the serial GPIO pins and my code instantly starts working.

    ...

    However, bluetooth is then completely dead (and I definitely want that working too). So this is definitely some kind of Device Tree conflict between bluetooth and serial in LibreElec.

    I guess I should move to making a Bug Report.

  • Can you test if this build works: libreelec-rpi2.arm-9.0-devel-20181217124947-c8d99e0.tar

    We were missing the driver for the miniuart in the RPi kernels - probably noone noticed that until now as most people only used the pl011 UART (I also usually just disable BT to get a full serial console).

    I did a quick test with this build, with an IQaudio DAC board installed on an RPi3B and console=ttyS0,115200 worked with it (that didn't work before).

    so long,

    Hias

    That would explain! Testing now, pretty sure your setup is the same as mine though.

  • And confirmed, that works. My Serial media controller (an arduino with buttons and a rotary encoder) works, bluetooth works too, no crashes in LibreELEC configuration!

    Thank you very much HiassofT, after more than a month of messing around this is the first time I find a media player distro that does everything i want!

    Will this fix go into the next Alpha build ? I could live with using this special build, but would be nice to be able to get updates in the future.

  • I did an update with a PI3+ and IQAudio board.

    I added

    dtoverlay=iqaudio-dacplus

    to config.txt


    Then I could select IQ audio output and it all "just works" on the 8.95.001 beta.

    BTW I regression tested the VNC issue I reported a while ago, and that still works too :)

    Looking good so far

    Roger