[Resolved] Serial port woes: unable to see Z-Stick from Pi Zero W

Hi, I have a Raspberry Pi Zero W running a vanilla install of openHAB 2.2.0-1 and am unable to get it to see an Aeotec Z-Stick Gen5. I’ve been working on this for a week and am beginning to pull my hair out. I’ve read all the threads regarding getting the serial port to work and have reimaged my sd-card and started fresh after my initial attempt with Rasperian and the openhab deb package.

I have 2 ttys:

crw-rw---- 1 root dialout 204, 64 Jan 29 15:40 /dev/ttyAMA0
crw-rw---- 1 root dialout   4, 64 Jan 29 15:23 /dev/ttyS0

and the group permissions seem correct:

$ sudo grep dialout /etc/group
dialout:x:20:openhabian,openhab

I’ve added the ttys to the /etc/default/openhab2:
EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyS0:/dev/ttyAMA0"
and they show up in the PaperUI interface, but any Z-Wave “thing” I add using either tty shows as
Status: OFFLINE - BRIDGE_OFFLINE Controller is offline

Checking, the serial ttys seem to be inactive:

$ systemctl status serial-getty@ttyAMA0.service
● serial-getty@ttyAMA0.service - Serial Getty on ttyAMA0
   Loaded: loaded (/lib/systemd/system/serial-getty@.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:agetty(8)
           man:systemd-getty-generator(8)
           http://0pointer.de/blog/projects/serial-console.html

and

$ systemctl status serial-getty@ttyS0.service
● serial-getty@ttyS0.service - Serial Getty on ttyS0
   Loaded: loaded (/lib/systemd/system/serial-getty@.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:agetty(8)
           man:systemd-getty-generator(8)
           http://0pointer.de/blog/projects/serial-console.html

One strange thing is that when I add a “thing”, the logs show openhab connecting:

2018-01-29 15:47:34.503 [INFO ] [ing.zwave.handler.ZWaveSerialHandler] - Connecting to serial port '/dev/ttyAMA0'
2018-01-29 15:47:34.728 [INFO ] [ing.zwave.handler.ZWaveSerialHandler] - Serial port is initialized

I’ve tried turning off Bluetooth with sudo openhab-config and Disable Bluetooth module, but it doesn’t seem to stick. I’ve tried adding dtoverlay=pi3-disable-bt to the /boot/cmdline.txt file, but it hasn’t helped:
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=9ce65417-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait dtoverlay=pi3-disable-bt
Bluetooth seems to be disabled (at least hcitool scan times out with the error Inquiry failed: Connection timed out).

Any help or pointers would be great appreciated! Thanks.

-Seren

As an update, lsusb only shows the standard virtual root device (Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub), so it seems that the usb stick isn’t visible to the system.

(I’ve also disabled bluetooth with systemctl disable bluetooth.service just to make sure that’s not messing with things.)

The z-stick is getting power since it’s flashing its red-yellow-blue cycle, and it does work since I was able to use it with Indigo on a Mac.

Plugging a mouse into the USB port does produce a stream of syslog messages indicating it was recognized.Plugging the z-stick into the Pi while it’s running causes it to hard reboot though. Testing with a powered USB hub gets it to show up. Hallelujah!

$ lsusb
Bus 001 Device 003: ID 0658:0200 Sigma Designs, Inc.
Bus 001 Device 002: ID 0409:0058 NEC Corp. HighSpeed Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I wonder if the z-stick is drawing too much power… It seems unlikely, but I’m not sure why else it wouldn’t be showing up…

Will update as things progress for anyone else with the same issue.

So after the plugging in the z-stick successfully, a new dev (/dev/ttyACM0) has shown up and seems to be pointing to the correct device:

$ /sys/class/tty/ | grep ttyACM0
lrwxrwxrwx  1 root root 0 Jan 31 14:09 ttyACM0 -> ../../devices/platform/soc/20980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/tty/ttyACM0/

and there’s now a /dev/serial directory. Yay!

I just tried adding a “thing” in the PaperUI and it registered correctly with the new device path.

Takeaway:
It seems that the problem all along was that the Z-Stick can’t be plugged into the Raspberry Pi Zero W directly. Right now it’s plugged into an unpowered usb hub and showing up fine.

It’s possible I have a bad board, since plugging the hub into the Pi (without anything attached to the hub) caused the Pi to reboot. I assume this isn’t normal…

I have the same z-stick with the same pi0w suffering the same symptoms, even with a powered OTG cable I can’t plug it in directly. I guess it’s too much for our little Pi’s to handle, rather than having a bad board.

Yeah, I think you’re right. I got a replacement board and had the same issue. After doing a bit more research it seems that Pi’s don’t have enough capacitance built into the USB bus to handle the load when something is first plugged in. I’m guessing that the hub I’m using lends enough capacitance to handle the voltage drop. It also might be helping even out current spikes that were overwhelming the board (that’s my only explanation for why the stick was going off-line sometimes).

I used the powered USB hub to power the pi. Looks a little trippy, but works well with only one power source needed.

Clever. I think I’ll try that as well (just have to find the power supply for the hub).