Jump to content

ODroid-C2: /dev/ttyS1: Input/output error


waynepiekarski

Recommended Posts

Armbianmonitor:

Hi everyone,

I'm trying to use the serial port on pins 8+10 on an ODroid C2. My understanding is that this maps to /dev/ttyS1 by default, but whenever I try to use this serial port, or any of ttyS0, S1, S2, S3, I get the error "Input/output error".

root@odroidc2:~# stty raw -crtscts 9600 < /dev/ttyS1
stty: 'standard input': Input/output error
root@odroidc2:~# cat /dev/ttyS1
cat: /dev/ttyS1: Input/output error

I have done a lot of searching on this forum and others, and it sounds like this could be something I need to enable in my device tree config, or some kind of overlay, but I'm very new to this and couldn't find anything specific on what to do. I had a look around in the /boot directory but couldn't find anything that might indicate that the UART was disabled. I would have thought this /dev/ttyS1 would be enabled by default, while /dev/ttyS2 is optional since it collides with some GPIO pins.

I'm using the latest Armbian_5.75_Odroidc2_Debian_stretch_next_4.19.20 and have also had the same problem with the latest Ubuntu as well.

Is there a trick to enabling the default UART included with the ODroid C2?

Thanks!

Link to comment
Share on other sites

The serial port speed is not configurable? Is this documented somewhere?

 

Also, this fails even without the stty command. So assuming the port was set to 115200 by default, cat /dev/ttyS1 still fails. So it appears like the port is not enabled properly, rather than a baud rate issue.

Link to comment
Share on other sites

1 minute ago, martinayotte said:

Did you added UARTx overlays in /boot/armbianEnv.txt ?

No, I haven't done anything like that. Its an unmodified stock image.

 

Is there a guide on how to set this up or what options are available? I've found older articles that talk about cloning github repos from hardkernel and rebuilding the device tree, but this seemed related to older kernels and overly complicated.

 

Is there a way to query what overlays are currently active and the /dev/* entries they map to?

Link to comment
Share on other sites

I read through the link https://docs.armbian.com/User-Guide_Allwinner_overlays/ and it mentions there is README in /boot/dtb/amlogic/overlay/README.meson-overlays which should contain the list of overlays. However, it doesn't mention anything about a UART:

Quote

This document describes overlays provided in the kernel packages
For generic Armbian overlays documentation please see
https://docs.armbian.com/User-Guide_Allwinner_overlays/

### Platform:

meson (Amlogic)

### Provided overlays:

- i2c8

### Overlay details:

### i2c8

Activates TWI/I2C bus 8

I2C8 pins (SCL, SDA): GPIO1-C4, GPIO1-C5

 

So I had a look in /boot/dtb/amlogic/overlay and there seem to be some overlay files.

Quote

/boot/dtb/amlogic/overlay$ ls -1 *
meson-fixup.scr
meson-i2cA.dtbo
meson-i2cB.dtbo
meson-uartC.dtbo
meson-w1-gpio.dtbo
README.meson-overlays

 

There appears to only be something for uartC, but I want to enable what I believe should be uartB (/dev/ttyS1). I tried putting overlays=uartB in /boot/armbianEnv.txt but nothing changed, and there is no .dtbo for this so I didn't expect much, but I don't really know what I'm doing here.

 

I also did a grep over the entire /boot directory looking for anything mentioning uart* inside the file, I found a few mentions and tried the following overlay line to see if any of them would make a difference:

Quote

verbosity=1
overlay_prefix=meson
rootdev=UUID=24e14127-60f7-4057-9dc1-310e21f86ff1
rootfstype=ext4
overlays=uartC meson-uartC uart0 uart1 uart2 uart3 uart_A uart_B uart_C uart_D uart_a uart_b uart_c uart_d uartA uartB uartC uartD meson-uartC
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

Nothing happened and all the /dev/ttyS0, ttyS1, etc devices still return "Input/output error" when accessed.

 

From the README file and available .dtbo files, it does not appear there is any way to enable the 2nd UART for /dev/ttyS1. I was expecting this to be enabled by default, but is there a trick to getting this working?

Link to comment
Share on other sites

10 hours ago, waynepiekarski said:

There appears to only be something for uartC, but I want to enable what I believe should be uartB (/dev/ttyS1).

I didn't pay attention at first that you were using a ODroid-C2 ... My bad ... -_-

The UART overlays work on AmLogic is far from been finished.

I will work on that soon and get back to you once I've get the UART on pins 8/10 working !

BTW, it will probably appears as /dev/ttyAML1 ...

 

EDIT: I've compared schematics of both NanoPi-K2 and ODroid-C2, and the NanoPi-K2 is using UartC for pins 8/10 while ODroidC2 is using UARTA. That is why only UartC has been implemented.

Since I don't own an ODroid-C2, I will have to do the work blindly without been able to test it ...

 

EDIT2 : Should be done with the following commits :

https://github.com/armbian/build/commit/f5b6dd722f935a5f4741a2bff5715513b4fc97e9

https://github.com/armbian/build/commit/839f2f151073928ed1e62d415ba5317f525b9e24

https://github.com/armbian/build/commit/47488561d401f9e221f1c1972a4ad2f533313ec4

 

Link to comment
Share on other sites

11 minutes ago, waynepiekarski said:

What is the timeline for these commits to make it into the next release?

I don't know since I'm not in charge of the build server.

I'm always building my own images. Using Armbian build scripts, it is pretty easy, you should give it a try ...

 

In the mean time, you can also decompile DTB into DTS, and edit manually the DTS by turning "serial@84c0" node status to "okay", and recompile the DTB, that should be enough to get the UARTA activated without overlays.

EDIT : Oh ! For manual editing of the DTS, you will also need to add the following in "aliases" section :

serial1 = "/soc/bus@c1100000/serial@84c0";

 

Link to comment
Share on other sites

I found there is a nightly build server, so I'll see if something gets generated tonight and test that. Otherwise I'll try rebuilding it myself or decompiling the DTB, although it will take me a while since I'm new to Armbian.

 

Thank you so much for your quick reply and commits fixing this, it is much appreciated!

Link to comment
Share on other sites

I found the build configuration https://github.com/armbian/build/blob/master/config/boards/odroidc2.conf which has "next" in the list of targets, so I guess this part is configured properly?

# S905 C2 quad core
BOARD_NAME="Odroid C2"
BOARDFAMILY="meson64"
BOOTCONFIG="odroid-c2_defconfig"
#
MODULES="bonding"
MODULES_NEXT=""
#
KERNEL_TARGET="default,next,dev"
CLI_TARGET="stretch,bionic:next"
DESKTOP_TARGET="stretch,bionic:next"
#
CLI_BETA_TARGET=""
DESKTOP_BETA_TARGET=""

 

Do I need to file an issue for the nightlies not being built?

Link to comment
Share on other sites

1 hour ago, waynepiekarski said:

so I guess this part is configured properly?

I'm not sure to understand the question ...

Personally, I'm always using "dev", although my commits have been done for both "dev" and "next".

 

1 hour ago, waynepiekarski said:

Do I need to file an issue for the nightlies not being built?

Maybe not, let ask to @Igor first ...

Link to comment
Share on other sites

8 hours ago, martinayotte said:

Maybe not, let ask to @Igor first ...


Last ones were build 25-Mar-2019 07:03 ... restarted now. Will be made in a few hours if nothing breaks. 

 

BTW. If you need another image of nightlies, you need to enable them - send a pull request with build config changes.

Link to comment
Share on other sites

I had a chance to download the nightly build, wrote it to an SD card, and I can now see a uartA overlay. I added overlays=uartA to /boot/armbianEnv.txt and after rebooting, I can see /dev/ttyAML1. But it doesn't return any data.

 

However, when I connect up a GPS serial device at 9600 baud to pin 10 on the header, labelled as RXD1 (#241), I get nothing. I also tried using pin 8 TXD1 (#240) as well, and nothing. I can connect the same serial device to an RPi3 and it works fine.

 

So perhaps this overlay is connecting to a different pin on the board? Originally I was expecting this to be called uartB, because I thought uartA would be the console?

 

Also, I tried the uartC overlay and it does nothing. It does not create any /dev/ttyAML* device, so perhaps that indicates there is some other problem here too?

 

I don't know much about how to debug these kinds of things, but running dmesg and grepping for AML returns this:

[    0.000000] Kernel command line: root=UUID=8594f23b-1887-4ca2-82a9-7a0203eba0ee rootwait rootfstype=ext4 panic=10 console=ttyAML0,115200 console=tty1 consoleblank=0 loglevel=1 ubootpart=b3770000-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=memory swapaccount=1
[    1.694196] c11084c0.serial: ttyAML1 at MMIO 0xc11084c0 (irq = 10, base_baud = 1500000) is a meson_uart
[    1.694482] c81004c0.serial: ttyAML0 at MMIO 0xc81004c0 (irq = 14, base_baud = 1500000) is a meson_uart
[    1.694517] printk: console [ttyAML0] enabled

Thanks,

Wayne

Link to comment
Share on other sites

7 hours ago, waynepiekarski said:

Originally I was expecting this to be called uartB, because I thought uartA would be the console?

No, SerialDebug is UARTA0 not UARTA. If you look at schematic, the pins 8/10 are really UARTA !

Since I don't own a ODroid-C2, I wasn't able to try the overlay properly, but you can do on your side by, first, using a loopback wire or jumper between pins 8/10, and run "picocom -b 115200 /dev/ttyAML1" and see if every keystroke you type is appearing as feedback. If Yes, then the issue is elsewhere ...

Link to comment
Share on other sites

I just tried the picocom test with a wire jumpered from pin 8 to pin 10, and nothing happened. There were no error messages, so the Linux device is valid, but no characters were being echo'd back.

I tried the same test with a USB-FTDI dongle and picocom -b 115200 /dev/ttyUSB0 and this worked ok and I could see my typing being echo'd back.

Link to comment
Share on other sites

45 minutes ago, waynepiekarski said:

I just tried the picocom test with a wire jumpered from pin 8 to pin 10, and nothing happened.

That is sad ... :(

Probably there is additional things missing in the PinCtrl code ... I will check later ...

Link to comment
Share on other sites

Good news! I tested the latest nightly build Armbian_5.77.190401_Odroidc2_Debian_stretch_dev_5.0.5.7z, and I was able to get /dev/ttyAML1 to do the loopback test at 115200, and talk to my GPS at 9600 baud. I just needed to add "overlays=uartA" into /boot/armbianEnv.txt and it all worked.

 

Thank you so much @martinayotte for fixing this for me so quickly, I very much appreciate it!

Link to comment
Share on other sites

4 hours ago, foobarto said:

Did this change end up in the Debian "next" build

The above commit done on March 31th was for meson64-dev, but it could be easily be copied, which I've just done and committed ...

 

Link to comment
Share on other sites

FYI i tried to enable uartA on OdroidC2 and followed this thread. I switched to stable build and found uartA overlay and enabled it.

After which i was still not able to use /dev/ttyAML1, had exact same symptoms:

On 3/30/2019 at 8:22 AM, waynepiekarski said:

However, when I connect up a GPS serial device at 9600 baud to pin 10 on the header, labelled as RXD1 (#241), I get nothing. I also tried using pin 8 TXD1 (#240) as well, and nothing. I can connect the same serial device to an RPi3 and it works fine.

 

so i edited meson-gxbb-odroidc2.dts and added pinctrl-0 and pinctrl-names lines:

 

                        serial@84c0 {
                                compatible = "amlogic,meson-gx-uart";
                                reg = <0x0 0x84c0 0x0 0x18>;
                                interrupts = <0x0 0x1a 0x1>;
                                status = "disabled";
                                clocks = <0xd 0xb 0x1a 0xd>;
                                clock-names = "xtal", "pclk", "baud";
                                pinctrl-names = "default";
                                pinctrl-0 = <0x72>;
                                phandle = <0x43>;
                        };

 

after reboot serial started working (got loopback).

probably last commit/patch (https://github.com/armbian/build/commit/22ca2b92a002fe22e2a61428741618295c424664) was not cherry-picked?

 

Edited by Jaxer
Link to comment
Share on other sites

1 hour ago, Jaxer said:

probably last commit/patch (https://github.com/armbian/build/commit/22ca2b92a002fe22e2a61428741618295c424664) was not cherry-picked?

The copy from DEV to NEXT has been committed here : https://github.com/armbian/build/commit/aa643138d70ae64ec30d3416f3d18fb24a1dbaaa

So, if your image was built before June 2nd, of course, it didn't included it ...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines