I've got a device (actually an arduino) that's sending serial data at 2400baud, 8N1. It's connected to my Pi Zero through optocouplers onto pin 8 and 10 (UART TX and UART RX). I've verified i'm seeing 3.3v signals onto the RX pin using a scope, it looks like i'd expect, a square wave representing digital data. For the software I'm using Java and the jSerialComm library to try and receive this data, but i'm having problems.
I'm opening port ttyAMA0
and setting the baud rate, stop bits etc correctly. When i try to read the first byte i get the exception This port appears to have been shutdown or disconnected.
Honestly I'm a bit confused about how to configure the Pi Zero correctly. I've got this at the end of boot.config
:
[all]
enable_uart=1
dtoverlay=disable-bt
Is this appropriate? My searching so far seems to indicate that by default the bluetooth hardware uses the UART, and I need to turn it off?
I keep seeing mention of a "second UART" on the Pi, but I only see a single one listed when i enumerate the ports. Is that what i'd expect? Where is the second one? If i run my program as root then i see another port,
ttyS0
, but that has the same result
EDIT: Optocouplers are to isolate the two devices from each other as they operate at different potentials and I don't want ground loops. They are SFH617A, and they are not inverting the signal: