Signal K not getting my Seatalk1 stream via GPIO on PI5
Hello everybody.
My old PI3 with the Signal K version included in Openplotter V3 had no problem reading my boat Seatalk 1 data stream.
After upgrading to a PI5 with the latest version of Signal K and using the same wiring and same GPIO port I get this error:
Traceback (most recent call last): File "<string>", line 21, in <module> File "/usr/lib/python3/dist-packages/pigpio.py", line 4504, in bb_serial_read_open return _u2i(_pigpio_command_ext(^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/pigpio.py", line 1062, in _pigpio_command_ext sl.s.sendall(ext)^^^^^^^^^^^^ AttributeError:'NoneType' object has no attribute 'sendall'
So the problem seems to be in the pigpio.py file. My programing skills are old and rusty, but I believe the problem is in the return value of the _pigpio_command_ext.
def _pigpio_command_ext(sl, cmd, p1, p2, p3, extents):
"""
Runs an extended pigpio socket command.
sl:= command socket and lock.
cmd:= the command to be executed.
p1:= command parameter 1 (if applicable).
p2:= command parameter 2 (if applicable).
p3:= total size in bytes of following extents
extents:= additional data blocks
"""
ext = bytearray(struct.pack('IIII', cmd, p1, p2, p3))
for x in extents:
if type(x) == type(""):
ext.extend(_b(x))
else:
ext.extend(x)
res = PI_CMD_INTERRUPTED
with sl.l:
sl.s.sendall(ext)
dummy, res = struct.unpack('12sI', sl.s.recv(_SOCK_CMD_LEN))
return res
A locking conflict with the socket? I would appreciate any help.
22 Replies
Unfortunately, pigpio is not supported on the Raspberry Pi 5. See the documentation for the updated support for Seatalk:
https://demo.signalk.org/documentation/setup/seatalk/seatalk.html
Yes, but I am using the gpiod library, that it is supposed to be compatible with Raspberry Pi 5.
I believe I have done everything by the book, in fact if I use a small python script I am able to see a nice stream of Seatalk messages coming through my pin 4
The error I posted above was shown a single time when upgrading from Signal K V 2.12.0 to 2.13.0 beta. The error that I see normally in the Signal K Dashboard is:
Traceback (most recent call last) File "<string>", line 299, in <module> ValueError: invalid literal for int()with base 10:
your first post refers to pigpio, but you are saying you are using gpiod. both should not be possible
I know, but... My Signal K data connection is configured to use the gpiod library. After switching from Signal K 2.12 to 2.13 I saw that error.
Now the error I get is:
Traceback (most recent call last) File "<string>", line 299, in <module> ValueError: invalid literal for int()with base 10:
That doesn't give a clue (at least to me) about the cause of the problem.
Do you have a screenshot of your configuration?
Assuming the error is in Signal K, this line could be the culprit: https://github.com/SignalK/signalk-server/blob/f5c59b15ee480f341ad6c8a4b6a5d58e388c9eb7/packages/streams/gpiod-seatalk.js#L323
This is the configuration. Nothing special.
The location of the error is parsing of the GPIOnn string, which was copied from the pigpio implementation - except that I dropped the Python 2.x support. Is it possible that the migrated setup still runs on Python 2?
I will try to check it in a minute.
pi@openplotter:~ $ ls /usr/bin/python*
/usr/bin/python /usr/bin/python3.11-config /usr/bin/python-dotenv
/usr/bin/python3 /usr/bin/python3-config
/usr/bin/python3.11 /usr/bin/python-config
pi@openplotter:~ $
Only Python 3 installed.
(I believe)
Can you try running the standalone python script referenced in the documentation?
@Teppo Kurki any way to get the configuration as saved by the form?
Yes, running the Seatalk Receiver script you wrote in Python I have no problems. I get a perfect stream of Seatalk messages.
(I checked them and they are all valid messages with reasonable values)
With this configuration:
ST_PIN = 4
ST_INVERT = 1 # 0=idle high, 1=idle low
ST_BITS = 9
ST_STOP = 1
ST_BAUD = 4800
$HOME/.signalk/settings.json is where server settings are saved
Excuse my ignorance: $HOME in my setup could be http://localhost:3000 ??
Because if I try to reach http://localhost:3000/.signalk/settings.json in my browser
I get: "Cannot GET /.signalk/settings.json"
(I will try to find the file and open it with a text editor)
You will have to open the file from the Pi, either with the file explorer or from the command line. $HOME is the starting directory of your user
The location that you are in when opening a terminal
Got it! Thanks
There is no mention of the Seatalk baudrate...
(maybe because is always 4800 bps?)
And no mention also of the GPIO pin number (4 in my setup).. Could that be related to the error?
After changing in the Data Connection interface the GPIO Pin from 4 to 5 a new line with the pin number appeared in the settings.json file!!!!
},
{
"pipeElements": [
{
"type": "providers/simple",
"options": {
"logging": false,
"type": "Seatalk",
"subOptions": {
"type": "gpiod",
"gpioInvert": true,
"gpio": "GPIO05"
}
}
}
],
"id": "stkopto",
"enabled": true
}
And after restarting the error disappeared!!!! Wow!
hmm... does changing it back to 4 give the same error again?
Let me check...
Going back to pin 4 and restarting. No error.
And now there is this line in settings.json:
so it seems to be an issue if the "default" value is kept
"gpio": "GPIO04"
Yes.
I never changed the pin number because the value showed in the interface was the right one.
Thanks a lot for your help !
no problem, thanks for the debugging 🙂