Can adaptor issue
After updating rpi from *old *to latest, unable to get USB Can adaptor working in signalk server
Using USB (canable.io) Can adaptor for n2k.
works fine on
Old_setup : rpi4 (older rpiOS/earlier nodejs, earlier signalk 1.4x server)
*Latest *Rpi4 build (same hw) but with latest rpiOS/nodejs/skserver
(linux 12 bookworm, nodejs v20.18.0, skserver V2.11.0)
.... and using 64bit version of Bookworm.. (as reccomended on rpi imager download)
Config
- have added two lines to /etc/rc.local
————-
# initialise CAN bus
sudo ip link set can0 up type can bitrate 250000
sudo ip link set can0 txqueuelen 1000
exit 0
————-
sudo lsusb
shows the USB device listed as expected
sudo ifconfig
shows below (the can adaptor is definitely there and generating messages.... but i note that ALL packets are shown as dropped.. a clue?)
signalk server
have setup connection in server identical to old version
nmea2000 source = Canbus (canboat.js)
interface = can0
(& done a server restart .. multiple times)
Summary:
i can reconnect a rpi4 (same hw) with older setup - and it finds n2k USB interface and works as expected (n2k working ok)
then swap to new rpi (exact same hw) but with updated OS/node/signalk refuses to work
(n2k connection in dashboard shows up with 5msg/s ... and NO signalk paths populated) ... it should be showing >140 msg/s.. and lots of paths
... something about the newer rpiOS? or nodejs? or ??? or is this a 64bit issue (old rpi was on 32bit i recall)
41 Replies
What happens when you run candump from the command line?
If candump fails, try sudo candump. Maybe it's a permissions issue.
candump …. “command not found” ..
do i need to install anything for CAN to work?
its stock rpi (latest) OS..
only thing related to CAN that ive done is the two lines in /etc/rc.local.
have i missed something?
installed can-utils
candump can0 … produces a result as expected … lots of scrolling data .
so doesnt appear to be a permission thing? (as i didnt need to use sudo)
further.
after running (successfully) candump can0 .
then running ifconfig.
there is now a difference between Rx packets and dropped packets
.. thatbis, before candump can0 was run, Rx and dropped were identical (ie all packets dropped)
now there is a difference.. presumably it didnt drop a bunch whilst running candump.
… this would appear to indicate that rpi is successfully recieving CAN data from USB interface,
but signalk (canboatjs ??) is not ingesting it?
question: do i need to manually install canboatjs??
and if yes, which of below?
candumpjs can0
produces a scrolling screen of messages … and i can see expected n2k messages in there.
…. all looks ok.
Any errors on the admin dashboard?
this is how i have the connection setup in server
looks good
nope.. all plugins etc showing clean
and thisnis what is shows for n2k connection
down below that, and errors?
possible clue?
because i “moved” all my configs across from old rpi to new,
i copied across the following directory
home/pi/.signalk/plugin-config-data
that's fine, should not have anything to do with incoming n2k
hmm and also
Signalk basedeltas.json, settings.json
wonder if this screwed it?
I don't see how
you sure there are no errors in the log? on the dashboard?
dashboard clean, all green ink!
checking log …
relevant part of settings.json.
look ok?
yep
does this dir exists:
/usr/lib/node_modules/signalk-server/node_modules/@canboat/canboatjs
yep.
oops thats different directory.
yep
log .. no clues…
which items should i have enabled?
Heading to the dentist…
Will get you some debug to turn on when I get a chance
ok good luck with that!
n2k trouble shooting for me tomorrow.. midnight here.
thx
Start with debug for canboatjs:candevice, and look at the log when sk starts up.
… i think im doing the correct process..
but where do i run this from?
Just go to the admin console
Under Server Logs
Put it in the text box at the top
ah
Turn on persist
i looked in signalk faq .. and found the reference to using above method (for debugging plugins)
i was trying self help!
not sure if relevant ..
nodejs -v
reports V20.18.0
looking at the error messages … is it the version of nodejs that is installed on my pi creatingbthe problem?
nodejs got updated tomthis latest version when installing Grafana i recall…. (the grafana install went ahead and updated nodejs i recall)
Yeah, that’s cause you updated nodejs after installing the sk server
bloody grafana install …. it just did it when installing “latest” grafana i guess
Just reinstall sk server
😦 that will overwrite existing?
… so i guess i copy across the various directories (again) …
will it overwrite the nodered flows also?
these are my notes that im using
Files/config to move manually
Signalk basedeltas.json, settings.json
/home/pi/.signalk/plugin-config-data
/home/pi/.signalk/red (nodered flows etc)
reinstall additional node pallettes .
look about right?
will tackle this tomorrow morning.. after coffee.
‘thanks for all your help.
that won't overwrite anything
it's just the "binary" files for the server
just use the usual "npm install -g" command
@Scott Bender
problem solved!
as always you nailed it. many thanks
and just for my & others future reference.
Its not the version of nodejs that is installed?
its because there was an update to nodejs after installing signalk-server ?
@Teppo Kurki
maybe we should put something in the "installing signalk" documentation about that?
I note the documentation has installing nodejs as the step prior to signalk-server (understandably)
however "later".. along comes another program install eg Grafana ... which goes ahead and updates nodejs version.. and at least in my case stopped CAN from working
i found this in FAQs .... perhaps we can make it more explicit?
"After any? update to nodejs, its recommended to reinstall signalk-server"
Please update it!
ok i will have a go at it.