This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
N2k/CAN stops listening after 25mins
#1
My NMEA2000 data connection stops receiving data after about 15 - 25 minutes. When I restart SignalK server, the data is read again.
When nothing is received in SK and I open candump, I can still see the data coming in on can0.

Hardware:
RPi CM4 on Waveshare CM4-IO-BASE-B, DSI display, Waveshare 2CH-CAN-HAT, Sailor Hat for RPi v2, Waveshare Relay Board.

Software:
OpenPlotter 3
config.txt:
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=23

/etc/network/interfaces.d/can0:
auto can0
iface can0 can static
        bitrate 250000
        post-up /sbin/ip link set can0 txqueuelen 65536

can1 is configured differently and continuously used for sending J1939 test data to a SH-ESP32-based board which receives those engine-related PGNs and translates and outputs them to NMEA2000, which is connected to RPi-can0. So can1 is not set up as datasource in SignalK.  But both can0 and can1 show up just fine in the CAN BUS app.

(I don't recall having this problem before I started playing with the above...)
Reply
#2
we use an better config for the canbus:

/etc/network/interfaces.d/can0:
#physical can interfaces
allow-hotplug can0
iface can0 can static
bitrate 250000
pre-up ip link set can0 type can restart-ms 100
down /sbin/ip link set $IFACE down
up /sbin/ifconfig $IFACE txqueuelen 10000


This has an automatical restart timer for the bus included.
try it out, before we found this somewhere in the finnisch HatLABs Documentation (thanks matti)
we had many quirks in high traffic CAN installations.

lg holger

PS: why is your quelengh so big?
Reply
#3
I'm using your interface settings now, but the data still stops after 25 minutes.
My original txqueuelen must have been some default value, I didn't set it consciously.
Reply
#4
Normaly if the CAN goes down ther will be no traffic in the can0 line.
I hope your config.txt uses another interrupt line as 23 for can1.

So there are only 2 devices on your can0 bus. i hope it is terminated correctly.
Power all devices down to measure.
now there must be an resistor of ~60 ohms between CAN H and L.

on nearly all waveshare interfaces i had to remove an little onboard resistor of 120 ohm to integrate it.

good luck.

Holger

PS: you could check signalK logs (enable n2k) or dmesg for any errors.
Reply
#5
Termination is ok. can0 stays up and there is traffic (sensors send at least once per second), but SignalK doesn't see it any more.

I enabled all n2k-related logging in the server. I see the PGNs coming in, then it stops. No error messages:

[...]
Mar 31 12:16:41 2023-03-31T10:16:41.048Z signalk-server:events:N2KAnalyzerOut [ { canId: 166854693, prio: 2, src: 37, dst: 255, pgn: 127488, timestamp: '2023-03-31T10:16:41.046Z', fields: { Instance: 'Single Engine or Dual Engine Port', Speed: 1176.3 }, description: 'Engine Parameters, Rapid Update' } ]
Mar 31 12:16:41 2023-03-31T10:16:41.199Z signalk-server:events:N2KAnalyzerOut [ { canId: 166854934, prio: 2, src: 22, dst: 255, pgn: 127489, timestamp: '2023-03-31T10:16:41.186Z', input: [], fields: { Instance: 'Single Engine or Dual Engine Port', Temperature: 296.71, 'Discrete Status 1': [], 'Discrete Status 2': [] }, description: 'Engine Parameters, Dynamic' } ]
Mar 31 12:16:41 2023-03-31T10:16:41.255Z signalk-server:events:N2KAnalyzerOut [ { canId: 368904214, prio: 5, src: 22, dst: 255, pgn: 130312, timestamp: '2023-03-31T10:16:41.251Z', fields: { SID: 1, Instance: 2, Source: 'Exhaust Gas Temperature', 'Actual Temperature': 296.77 }, description: 'Temperature' } ]
Mar 31 12:16:57 GET /admin/ 200 3.202 ms - 562
Mar 31 12:16:57 GET /admin/fonts/Simple-Line-Icons.3826fa1cb2348dd93948a50cbd2b8fb6.woff2 304 4.704 ms - -
Mar 31 12:16:57 GET /admin/fonts/fa-solid-900.1551f4f60c37af51121f106501f69b80.woff2 304 4.058 ms - -
Mar 31 12:16:57 GET /admin/436.js 304 4.473 ms - -
[....]

When the data flow stops, the CAN interfaces in the CAN APP look distorted:
   

After SignalK restart they are back ok:
   
Reply
#6
I have seen this disortion also sometimes on my Pi. Yes true - after an Restart it normalizes sometimes.
But if not, it is an Quirk with all the Restarts to delete the connection and set it again. But this is OP Problem.

Your Probs seem to lie inside Signal K, maybe it is better to ask in the Signal K at https://signalk-dev.slack.com/


How
Reply
#7
The connection irregularity in the CAN Bus app could indeed be unrelated. Currently I'm getting data but the CAN App shows the messed up connections.
Is it required to use the CAN Bus app to set up the CAN connections or is it enough to add a CAN data connection in SignalK server?
Reply
#8
The problem with the data loss was solved by installing the current version of socketcan!
The strange display of the can interfaces in "CAN Bus" remains but I don't mind much.
Reply
#9
Hey, fine that the slack team found an solution.
Reply
#10
After some longer testing it turns out the data still stops, but the latest version of canboatjs compensates for that by restarting the connection.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)