Matti Airas - Signal K server exposes a hard-co...
Signal K server exposes a hard-coded NMEA 2000 serial number of 123456 that is set in canboatjs (
lib/candevices.js:65
). This prevents multiple SK servers from participating on a single bus. I'd like to make the serial code dynamic - and possibly expose some other parameters such as LEN to SK settings.
Ideally, I think the serial code should be per-interface if someone insists on connecting multiple CAN interfaces to the same bus (don't know why anyone would do that, but I've seen weirder stuff happen). Would it be OK if I set the serial code value to the interface uniqueNumber
option field value?22 Replies
being able to customise that property is a good idea in general (can't recall exactly why it was requested before) and a step towards having multiple can interfaces (that involves also other things, like we have just a global sk-to-n2k conversion facility now)
I’m ok with setting that to the uniqueNumber field
That was simple: https://github.com/canboat/canboatjs/pull/267
GitHub
Make the NMEA 2000 product serial code unique by mairas · Pull Requ...
Use the uniqueNumber value as the NMEA 2000 product info model serial code instead of a hard-coded constant. This should allow having multiple Signal K servers on the same NMEA 2000 bus (a common o...
Did this actually cause any issues?
Yeah. I have a B&G MfD in my lab that's mostly showing the device list. If I have only one SK server connected to the N2K network, it shows up fine, but if there are two, neither of them is shown.
Are you sure that is because of the serial number?
No 🙂
But I can test now
You going to modify by hand? Or need me to make a release?
I just modified the file directly.
But yeah, so I was wrong - it's not the serial number.
Only one of the devices is shown.
Hmm….
I’d say it’s more likely someone in the address claim
Try changing the device instance stuff
I disconnected the first one. The second one doesn't come visible.
On its own, that is.
If you restart the second one?
So the sk servers see each other? (At the bottom of the data browser)
Darn. Wait. There might be some issue with that device. It was just a random HALPI test device that I picked up. It's not showing on the MfD even by itself...
OK, so for some reason the SK server crashes soon after restart on the other device. I might've done some wonky tests on the OpenPlotter image I have running there. The server stays up if it's manually restarted. Now I'm having only that device visible on the MfD and not the patched one.
I'll try changing the device instance.
I changed the lower, upper and system instance values from 0 to 1, and... wait, now the devices disappeared on the MfD???
I kicked up the "AOS NMEA Simulator" software on a Windows VM. Despite the name, it can also display fairly detailed information on the network devices.
It's also seeing only one device with address 100.
I changed the preferred address default value to 101 and now the modified device came online with address 107. So the address claim protocol seems to do its thing. Now both devices are transmitting, the other one with address 100. But when I scan the devices on the MfD, only the modified one shows up.
So somehow the response to whatever the info request PGN was gets botched up, maybe?
126996 Product Information
But at least they end up with different addresses
Hmm. Definitely something wrong here. You should not have to change that, the negotiation stuff should have chosen a different address.
Yup
The NMEA Simulator claims addresses 101-106, so that explains that.
I'll change the default value back.
So definitely sounds like the two sk servers are not negotiating correctly
Yes. They both claim address 100.
But even when the addresses were different, there was something wonky going on.
Because only one was visible.
Not sure what's going on. The address claim code looks sane. But I didn't enable debug output or anything yet.
I think I'm off to bed...
Ok. I need to order a cable so I can test this. Won’t have time til next week to dig in deep…
so, I definitely found an issue in the address claim stuff.
but I am not seeing any other issues, if I change the preferredAddress or one sk instance, then both show up on my Garmin MFD in my lab
I don't have any B&G mfd's, but I do have a Triton2 display on the boat. Will test with that next time I'm on the boat and have time...
I have publish the address claim fix and your serial number change (v2.6.0)
Triton2 shows two Signal K devices
I'm pretty sure all of the issues were just due to that issue. I'll test soon. Thank you!
Turns out my PR works... well, differently from what I intended. All SK server instances now expose serial number 576977. Sure, it's more random than 123456, but still somewhat lacking in entropy.
Why are they using that?
Are you using the same settings.json (same uniqueNumber)?
🤦
Yeah. My pre-configured OpenPlotter image happens to has use that as uniqueNumber: https://github.com/hatlabs/openplotter-pi-gen/blob/op4-halpi/stage7/03-setup-interfaces/files/settings.json#L15
GitHub
openplotter-pi-gen/stage7/03-setup-interfaces/files/settings.json a...
OpenPlotter customizations for HALPI use. Contribute to hatlabs/openplotter-pi-gen development by creating an account on GitHub.