Coder Social home page Coder Social logo

canboat / canboat Goto Github PK

View Code? Open in Web Editor NEW
494.0 69.0 175.0 23.64 MB

CAN Boat provides NMEA 2000 and NMEA 0183 utilities. It contains a NMEA 2000 PGN decoder and can read and write N2K messages. It is not meant as an end-user tool but as a discovery mechanism for delving into NMEA 2000 networks.

License: Other

Makefile 2.60% C 88.22% PHP 1.58% XSLT 3.71% Perl 1.29% Python 2.54% Shell 0.04% Dockerfile 0.02%
boating n2k nmea-parser nmea-sentences nmea0183 nmea2000 yachting

canboat's Introduction

CANBOAT

A small but effective set of command-line utilities to work with CAN networks on BOATs. The most common version of CAN networks on board, and in fact at the moment the only ones that this suite can analyse, is NMEA 2000.

The NMEA 2000 database and implementation is copyrighted by the NMEA (National Marine Electronics Association). Access is restricted to members and parties that pay for it. If they do so they are not able to divulge the content of the database, thus making it impossible for open source developers to get access to it.

For this reason we have reverse engineered the NMEA 2000 database by network observation and assembling data from public sources.

Quick reference

If you just want to know how the NMEA 2000 protocol works, with an explanation of all reverse engineered data, please go to the documentation page.

To use the programs included in this project you may need a supported CAN interface. This can be a marketed-as-such NMEA 2000 Gateway or a non NMEA specific CAN interface.

For more information go to the CANBoat Wiki.

Building, Development and Testing

In Wiki you can find instructions on how to build the programs on your own computer and how to start extending the PGN database. Short instructions are also found in BUILDING.md.

Version history

See Changelog.

Related Projects

  • canboatjs Pure JavaScript NMEA 2000 decoder and encoder

(C) 2009-2023, Kees Verruijt, Harlingen, The Netherlands.

This file is part of CANboat.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

canboat's People

Contributors

acolomb avatar aldas avatar arks-public avatar bioffe01 avatar cas206 avatar chacal avatar cmotelet avatar e-sailing avatar fabdrol avatar francois-berder avatar g2griz avatar gobenb avatar htool avatar jeronimo avatar jncarter123 avatar jpilet avatar keesverruijt avatar larsujensen avatar mairas avatar mbj4668 avatar mglonnro avatar multimike avatar ph1l avatar sbender9 avatar selebrator avatar timmathews avatar tjkurki avatar tkurki avatar twoclocks avatar woobagooba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

canboat's Issues

unit conversion MWV msg

Hello,

I have made the following change to transform m/s (n2k) to knots (N) in the 183 msg in the wind speed.

The format must be 000.0 to be read by Furuno

Line 235

float m2n;

Line 249

m2n = strtof(speed, NULL);
m2n = m2n * 1.944;
snprintf(speed,12, "%05.1f", m2n);
.... 
if (strcmp(reference, "True") == 0)
{
    nmea0183CreateMessage(msg183, src, "MWV,%s,T,%s,N,A", angle, speed);

updated comment to indent code properly -- canboat

Cannot start the n2kd_monitor (end of canboat install)

Hi,

After successful creation of the /etc/default/n2kd file in the right folder (struggled a bit, because rights are limited --> had to do it in "root" user mode), I now have an issue when trying to start the server:

pi@raspberrypi:~ $ /usr/local/bin/n2kd_monitor Can't locate ConfigReader/Simple.pm in @INC (you may need to install the ConfigReader::Simple module) (@INC contains: /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/arm-linux-gnueabihf/perl5/5.20 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at /usr/local/bin/n2kd_monitor line 38. BEGIN failed--compilation aborted at /usr/local/bin/n2kd_monitor line 38. pi@raspberrypi:~ $

I've looked for this ConfigReader, but cannot find reference on the net (?)
(sorry again if my questions are stupid ;))

thks

Issue with "make" function - installation of canboat

Hi,

Totally beginner with RPi, I would like to setup a SignalK server for my boat, using a Pi. At this stage, I don't know much about programming, but intend to end-up with capability to send my boat's data to the cloud, and remote-access the boat's systems from home.

Sadly, I ran into my first (of many) issues right when trying to install canboat utility on my new Pi 3B with last version of Jessie. Issue occured when executing the "make" command

 Entering directory '/home/pi/canboat/analyzer'
../rel/linux-armv7l/analyzer -explain-xml >pgns.xml && xsltproc pgns2json.xslt pgns.xml >pgns.json
/bin/sh: 1: xsltproc: not found
Makefile:34: recipe for target 'json' failed
make[1]: *** [json] Error 127
make[1]: Leaving directory '/home/pi/canboat/analyzer'
Makefile:14: recipe for target 'all' failed
make: *** [all] Error 

then, when running "make install", I got this:

pi@raspberrypi:~/canboat` $ make install
for i in rel/linux-armv7l/* util/* */*_monitor; do f=`basename $i`; rm -f /usr/local/bin/$f; cp $i /usr/local/bin; done
cp: cannot create regular file ‘/usr/local/bin/actisense-serial’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/analyzer’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/candump2analyzer’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/command-group-function’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/iptee’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/n2kd’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/n2kd_monitor’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/nmea0183-serial’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/request-group-function’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/socketcan-writer’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/list-product-information’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/n2kd_monitor’: Permission denied
cp: cannot create regular file ‘/usr/local/bin/n2kd_nmea_monitor’: Permission denied
Makefile:24: recipe for target 'install' failed
make: *** [install] Error 1

Tried to remove canboat folder, and restart from the beginning. Same issue.
As I'm new, very sorry in advance for mis-formatting, or mis-manipulations.

Thanks in advance for your help

Invalid pngs.json

Not sure how this is generated but in pngs.json file for 127489 png for discreteStatus1 and discreteStatus2 fields EnumBitValues is invalid JSON (from https://en.wikipedia.org/wiki/JSON - Object: an unordered collection of name/value pairs where the names (also called keys) are strings) and can't be parsed by other parsers.
Instead of {Bit:'0',Name:'Check Engine'} shoud be {'Bit':'0','Name':'Check Engine'}

If there won't be any more xml changes I can just update that json file manually and make pull request myself.

Support additional log file formats

I propose to add support for the NMEA 2000 log files that Garmin chart plotters can produce in diagnostics mode, as well as for the free-as-in-beer PCAN-View utility from PEAK-Systems.

The analyzer code is not very well structured and modularized, so it's not easy to detect other formats and add a corresponding parser. Otherwise I would have already tried to implement these :-) Not sure if separate xxx2analyer tools would make sense here or if the format support should be baked in directly with runtime detection, because there are already three different dialects supported.

Sample files for each format will follow shortly in a Pull Request and they would be rather easy to auto-detect.

Canboat not compiled correctly, caused issues with OpenCPN?

I am trying to compile CANBOAT on to a RPi2 running a fully updated and upgraded Jessie, I keep getting this result from the sudo make install command:

for i in rel/linux-armv7l/* util/* /_monitor; do f=basename $i; rm -f /usr/local/bin/$f; cp $i /usr/local/bin; done killall -9 actisense-serial n2kd socketcan-writer actisense-serial: no process found n2kd: no process found socketcan-writer: no process found Makefile:23: recipe for target 'install' failed make: [install] Error 1 (ignored)

I have checked all the directories and they all seem to complete with their respective Makefiles. It has also caused an Issue with OpenCPN, it opens the program and then crashes straight away. I had a similar problem before and I checked the config file and it seems to have removed some of the graphics lines I added to it to run openCPN. Any help would be very much appreciated to get CANBOAT running, please be gentle I am a complete noob to Linux

Comma is a special character in LOOKUP_DEVICE_CLASS

The extra comma after Deck at

#define LOOKUP_DEVICE_CLASS ( \
          ",0=Reserved for 2000 Use" \
          ",10=System tools" \
          ",20=Safety systems" \
          ",25=Internetwork device" \
          ",30=Electrical Distribution" \
          ",35=Electrical Generation" \
          ",40=Steering and Control surfaces" \
          ",50=Propulsion" \
          ",60=Navigation" \
          ",70=Communication" \
          ",75=Sensor Communication Interface" \
          ",80=Instrumentation/general systems" \
          ",85=External Environment" \
          ",90=Internal Environment" \
          ",100=Deck, cargo and fishing equipment systems" \
          ",120=Display" \
          ",125=Entertainment" \
          )

in https://github.com/canboat/canboat/blob/master/analyzer/pgn.h#L175

produces mangled xml output and probably doesn't work as intended:

https://github.com/tkurki/canboat/blob/9be1a425e22fe32900c7f3f91534a903ad853cd5/analyzer/pgns.xml#L183

Small size of CAN dump on vcan0 is not getting forwarded by n2kd to TCP clients

Hi,

I am using below command to send data over TCP.
$ candump vcan0 | ./candump2analyzer | ./analyzer | ./n2kd

I am using another application which sends data on vcan0.

I am able to fetch data on TCP client side when data is above 7kB.
However, when I send less than 7kB or just one packet on vcan0 then I am not getting data on TCP client side.

Regards,
Mehul

Improve handling of variable length strings, especially in JSON and XML descriptions

Definition for 126998 is wrong. It has only fields:
1 Installation Description, Field 1
2 Installation Description, Field 2
3 Manufacturer Information, Field 3
All fields are variable length strings so that there is:
<0x01>, where len is length()+2. So this PGN message can be:
<0x02><0x01><0x03><0x01><"C"><0x05><0x01><"CAT">

Also on PGN 129802 field 7 "Safety Related Text" is constructed as above - not fixed length field. And possibly on other PGNs containing text data.

n2kd crashes when connecting to caching server

Using the most recent version of canboat.
Have an Actisense serial NGT-1, not USB.

Running actisense-serial /dev/ttyS1 | analyzer -json | n2kd to try to debug why n2kd_monitor was restarting constantly.

When connecting to the caching server on port 2597, n2kd exits with the below. This can be reproduced every time I try to connect to the caching server. I suspect it's a device on my network (very busy) that is throwing crappy data, but I can't be 100% sure:

FATAL 2015-01-11 11:07:01.504 [n2kd] Stream 0 contains invalid fd 976629818

Connecting to the non-caching json server on 2598, and the NMEA0183 server on 2599 work fine for long periods of time.

NMEA0183 sentence WMV is missing 'Active' field

@villalolo writes:

Hi, i dont know how to use this, so I m telling you the change i made,
the nmea message for MWV is wrong, it misses the A, at the end. This A, validate the message.
ref: Nema V4 /2008

$--MWV,x.x,a,x.x,a,A*hh
A = Data Valid, V = Data invalid

without the ,A. opencpn will not recognize it.

this is wrong: $01MWV,199.5,R,7.95,N6E
this is good: $01MWV,207.6,R,5.79,N,A04

so i have made the changes from this

nmea0183CreateMessage(msg183, src, "MWV,%s,T,%s,N", angle, speed);
nmea0183CreateMessage(msg183, src, "MWV,%s,R,%s,N", angle, speed);

to this

nmea0183CreateMessage(msg183, src, "MWV,%s,T,%s,N,A", angle, speed); 
mmea0183CreateMessage(msg183, src, "MWV,%s,R,%s,N,A", angle, speed);

thanks for the great work!

Accept candump output format as analyzer input

It would be very useful to be able to pipe candump's output format directly into analyzer,

Here is a sample...

<0x19fa0300> [8] 9a d3 94 00 d8 00 64 00
<0x19fa0400> [8] 80 93 9a fd 0c 2b 50 2c
<0x19fa0400> [8] 81 5b 3d 9c ff e9 00 00
<0x19fa0400> [8] 82 00 f0 07 d1 06 ff 1d
<0x19fa0400> [8] 83 a7 05 00 00 00 00 f1
<0x19fa0400> [8] 84 02 e8 19 c4 4f e0 0b
<0x19fa0400> [8] 85 84 00 00 00 f2 1d 22
<0x19fa0400> [8] 86 24 70 b9 a6 0c 46 00
<0x19fa0400> [8] 87 00 00 f2 05 ff 2c f3
<0x19fa0400> [8] 88 1b b8 0a 19 00 00 00
<0x19fa0400> [8] 89 f2 1a 45 2a 7e 61 71
<0x19fa0400> [8] 8a 0c 41 00 00 00 f2 0f
<0x19fa0400> [8] 8b 39 19 f1 84 a9 08 a6
<0x19fa0400> [8] 8c 00 00 00 f2 08 8b 09
<0x19fa0400> [8] 8d 73 32 61 06 d6 00 00
<0x19fa0400> [8] 8e 00 f2 15 39 0a 93 ce
<0x19fa0400> [8] 8f 2e 07 00 00 00 00 f1
<0x19fa0400> [8] 90 04 00 00 cf 51 9c ff
<0x19fa0400> [8] 91 00 00 00 00 f0 09 0b
<0x19fa0400> [8] 92 02 e6 64 9c ff 00 00
<0x19fa0400> [8] 93 00 00 f0 0a 8b 09 ad
<0x19fa0400> [8] 94 2d 9c ff 00 00 00 00
<0x19fa0400> [8] 95 f0 ff ff ff ff ff ff
<0x0df80500> [8] 80 2f 9a 8c 3d b0 f1 8f
<0x0df80500> [8] 81 1e c0 cd 32 c9 24 23
<0x0df80500> [8] 82 e5 05 00 fd 09 49 8c
<0x0df80500> [8] 83 88 16 f6 d9 e5 25 02
<0x0df80500> [8] 84 00 00 00 00 13 fc 06
<0x0df80500> [8] 85 94 00 06 01 dc f2 ff
<0x0df80500> [8] 86 ff 00 ff ff ff ff ff
<0x1defff00> [8] a0 3e e5 98 17 00 04 04
<0x1defff00> [8] a1 60 34 be 41 0f 6d 32
<0x1defff00> [8] a2 42 52 30 4a 42 52 30
<0x1defff00> [8] a3 4a 42 52 30 4a 42 0a
<0x1defff00> [8] a4 d7 a3 3c cd cc cc 3d
<0x1defff00> [8] a5 0a d7 a3 3c cd cc cc
<0x1defff00> [8] a6 3d 36 c2 bd 3f 16 66
<0x1defff00> [8] a7 0a 40 64 cc 27 40 00
<0x1defff00> [8] a8 00 80 3f 2f dd 64 3f

I can provide more if needed.

129540 Satellites in view: use array?

JSON output for 129540 looks like n times

    "PRN XX": "67",
    "Elevation XX": "41.0",
    "Azimuth XX": "207.0",
    "SNR XX": "31.00",
    "Range residuals XX": "0",
    "Status XX": "Used"

How about making the satellites' details an array?

Manufacturer Code as Code, not Name

Manufacturer Code in for example PGN 60928 fields is being translated to a human oriented manufacturer name.

This is a bit confusing (Code is actually Name) and if a downstream app would like to have access to the original value there is no convenient way to do that.

I propose that Manufacturer Code should be output by default as the untranslated numeric value and there should be an option to additionally include the translated value as Manufacture Namefield (-manufacturerName) and for backwards compatibility perhaps an option to function like it does today (-manufacturerNameAsCode).

Thoughts?

pgn 130306 (WindData) has the wrong bit offset for Reference

You have bitoffset as 40.

It should be 45. Bit 40 is in an undefined range and most NMEA 2000 implementations will have the bits set high there (so Reference will always be 7 instead of matching your lookup table).

I also believe that the lookup table isn't correct, it contains 4 bits worth of values but the NMEA 2000 logs that I have only show 3 bits worth of values. You have the BitLength set correctly to 3.

socketcan

In your READMA you mention, that it's possible to use the socketcan driver. How can I configure the analyzer and n2kd to use socketcan instead of the actisense serial?

NMEA0183 PGNs

This is more of a feature request or a question. Is there any easy way or plan to add more PGN's to the NMEA0183 server? Specifically I am looking for the battery and other power monitoring ones as I want to use iNavX and other 3rd party tools to see that data. SignalK and some of the other tools aren't fully supported yet by remote apps, and can't figure out another way to do this.

Perhaps if I could somehow send the NMEA 2000 stream directly out some of these apps would understand? Or am I missing some functionality that might already help me?

systemd interferes with fork in n2kd_monitor

What the title says. After running n2kd_monitor once to set up the pipeline once, an additional n2kd_monitor process is spawned about twice per minute. During testing, I found this:

root@navy:~/n2k# ps aux | grep n2kd
root 1617 0.0 0.2 25152 5164 pts/1 S 10:25 0:00 /usr/bin/perl /usr/local/bin/n2kd_monitor
root 1633 0.0 0.1 13228 2828 pts/1 S 10:25 0:00 /bin/bash -c actisense-serial -t 10 /dev/ttyUSB0 | analyzer -json -json | n2kd
root 1636 0.7 0.0 40700 1272 pts/1 S 10:25 0:04 n2kd
root 1654 0.0 0.1 25152 3828 pts/1 S 10:26 0:00 /usr/bin/perl /usr/local/bin/n2kd_monitor
root 1675 0.0 0.1 25152 3652 pts/1 S 10:26 0:00 /usr/bin/perl /usr/local/bin/n2kd_monitor
root 1685 0.0 0.1 25152 3652 pts/1 S 10:27 0:00 /usr/bin/perl /usr/local/bin/n2kd_monitor
root 1691 0.0 0.1 25152 3652 pts/1 S 10:27 0:00 /usr/bin/perl /usr/local/bin/n2kd_monitor
root 1692 0.0 0.1 25152 3652 pts/1 S 10:28 0:00 /usr/bin/perl /usr/local/bin/n2kd_monitor
.....snip......
root 1798 0.0 0.1 12728 2116 pts/0 S+ 10:35 0:00 grep n2kd
root@navy:~/n2k# pstree
systemd─┬─acpid
├─agetty
├─atd
├─cron
├─dbus-daemon
├─dhclient
├─exim4
├─n2kd_monitor─┬─bash─┬─actisense-seria
│ │ ├─analyzer
│ │ └─n2kd
│ └─n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor───n2kd_monitor──........etc

Reading from can0 interface

Hi,

actisense serial module reads data from either serial or USB interface on Linux platform. I have one board which exports can0 interface. So, we can read-write to this interface via SocketCAN API.

I want to read-write data from can0 network interface.
Is this method supported in current source code by any way?

-Mehul

Change PGN source from C to XML

The PGN database would be more useful and easier to maintain if it was already in XML with a proper DTD.
This would be accompanied with an XSL file to generate C code; the C analyzer should not depend on XML libraries but a compile time generation is fine.

pgns.json and pgns.xml are missing size field

pgns.json doesn't have the size field that is in pgn.h. pgns.xml also appears to be missing this field.

This makes it difficult to know if a PGN fits into a single packet, or is using the fast-packet protocol.

PGN 128259

According to my tests Field 4 "Speed Water Referenced Type" is 1 byte length. E.g. Airmar sensor send 0x00 for "Water referenced". If the field would be 4 bit, it should send 0xf0. Also NMEA Reader shows on that point 0 and for value 0xf0 240.

There is also new field 5:
4 bits, "Speed direction". It is not yet clear for me, what that means.

N2KD AJAX server behavior?

Hi

I'm not understanding n2kd's AJAX port. Wiki states n2kd will wait for 500ms following client connect, then sends out the last of each PGN type received within the last X seconds (where X is 16 minutes for AIS and Sonic Hub, 120 seconds otherwise.)

Is my understanding correct?

Is the connection closed after the transmit?

I have the following Python client...

#!/usr/bin/env python

import socket
import sys

HOST, PORT = '192.168.1.119', 2598
BUFFER_SIZE = 256

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
while True:
    data = s.recv(BUFFER_SIZE)
    sys.stdout.write (data.decode("utf-8"))
s.close()

This client only displays 4 of the 10 or so PGNs reported at start-up of n2kd.

Appreciate your help ;)

analyzer 249 seg faults when running -explain or -explain-xml

Confirmed to occur on multiple linux platforms.

Seems to be happening within this PGN...

{ "SonicHub: FM Radio", 130816, false, 0x40, 0,
{ { "Manufacturer Code", 11, RES_MANUFACTURER, false, "=275", "Navico" }
, { "Reserved", 2, 1, false, 0, "" }
, { "Industry Code", 3, RES_LOOKUP, false, LOOKUP_INDUSTRY_CODE, "" }
, { "Reserved", BYTES(1), 1, false, 0, "" }
, { "Proprietary ID", BYTES(1), RES_LOOKUP, false, "=12", "FM Radio" }
, { "Control", BYTES(1), RES_LOOKUP, false, ",0=Set,128=Ack", "" }
, { "Item", BYTES(1), RES_LOOKUP, false, ",1=Seeking up,2=Tuned,3=Seeking down", "" }
, { "Frequency", BYTES(4), 0.001, false, "kHz", "" }
, { "Noise level", 2, 1, false, 0, "" } // Not sure about this
, { "Signal level", 4, 1, false, 0, "" } // ... and this, doesn't make complete sense compared to display
, { "Reserved", 2, 1, false, 0, "" }
, { "Text", BYTES(32), RES_STRINGLZ, false, 0, "" }
, { 0 }
}

Bluetooth Support

Hi all,
wondering if anyone might be interested in coding an API for BLE modem support into canboat. Have a new can/can gateway that we've developed specifically to translate "uncommon" ECM/PCM messages into N2k PGN sets for display on plotter/gauge. We included a BT 4.0 modem in the hardware design, but haven't had any time to work on additional software support. The rest of it works great, and it provides a direct unmolested SPI or UART line onto the NMEA bus. So figured this might be of some interest to the canboat community. Let me know if interested at taking a look.

-K

How to send PGN 126208 (set transmission interval)?

Sorry to post a how-to-use question as an issue, but I think documentation is quite scarce, and I'm keen to know the right way to do this.

I'm trying to change transmission interval for a Victron MPPT 150/70 solar charge controller. The documentation (pdf) says:

To enable transmission of this PGN, change the transmission interval. To do this at protocol level, see NMEA2000 documentation, PGN 126208 - NMEA - Request group function (field 1 = 0x00). And then field 3, transmission interval.

I'm successfully reading data with candump slcan0, but I'm not sure what input I should give to the socketcan-writer program - if that's even the correct way.

More info on PGN 126208.

PGN 65285 for Lowrance Temperature sensor doesn't support Temperature Source

So far the temperature source is always returning 0, I am going to start to document here the value the sensor is using based on the different values available in B&G Zeus 2 interface.

{ "Lowrance: Temperature", 65285, false, 8, 0,
  { { "Manufacturer Code", 11, RES_MANUFACTURER, false, "=140", "Lowrance" }
  , { "Reserved", 2, RES_NOTUSED, false, 0, "" }
  , { "Industry Code", 3, RES_LOOKUP, false, "=4", "Marine Industry" }
  , { "Temperature Instance", 4, 1, false, 0, "" }
  , { "Temperature Source", 4, 1, false, 0, "" }
  , { "Actual Temperature", BYTES(2), RES_TEMPERATURE, false, "K", "" }
  , { 0 }
  }
}

EnumValues fields often have the wrong size

As an example this field comes from PGN 129038:
{
"Order":15,
"Id":"navStatus",
"Name":"Nav Status",
"BitLength":8,
"BitOffset":200,
"BitStart":0,
"Type":"Lookup table",
"Signed":false,
"EnumValues":[
{"0": "Under way using engine"},
{"1": "At anchor"},
{"2": "Not under command"},
{"3": "Restricted manoeuverability"},
{"4": "Constrained by her draught"},
{"5": "Moored"},
{"6": "Aground"},
{"7": "Engaged in Fishing"},
{"8": "Under way sailing"}]},

The BitLength here is 8, but the table only requires 4 bits to store the 9 values. Simrad and Raymarine will pad the un-specified bits with 1, so the raw value for this will show up as 240 (0b11110000) when it should be 0. The top 4 bits are reserved, and NMEA 2000 recommends that reserved fields keep the bit set to 1.

I've found this to be true of almost all EnumValues in the system, here is another example that is 1 bit with 1 bit reserved, but pgns.json has it as two bits (from pgn 127250):
{
"Order":5,
"Id":"reference",
"Name":"Reference",
"BitLength":2,
"BitOffset":56,
"BitStart":0,
"Type":"Lookup table",
"Signed":false,
"EnumValues":[
{"0": "True"},
{"1": "Magnetic"}]}]},

I've worked around this in my own application by computing the most bits necessary to store all enum values, and assuming that any higher bits are reserved.

Nonstandard timestamp

Json timestamps look like
2013-10-08-15:47:28.263 and afaik should be
2013-10-08T15:47:28.263Z

Source name 01 02 not working

Hello,

Is it possible to allow users to chose the name of the nmea msg source. For instance, my wind instrument appears as 01 in the nmea0183 msg. however, Maxi or Furno wont recognize the message. They are expecting a "WI"
$01MWV should be $WIMWV.... I think for Garmn its $IIMWV....

$WIMWV,163.6,R,012.7,N,A*25 is actually working ... god I hate that Furno... !! :).

thanks a lot

N2KD's JSON caching port...

Thanks much for the expanded information in N2KD's wiki page. Its now apparent ... different app layer data items can be received within different instances of same PGN from the same address. So just saving the last PGN from any address will mean app layer data is lost. This smells like a deficiency in the PGN design ... but it is what it is.

So now I'm wondering about an alternative to the JSON caching port format. Something like the following ....

So instead of this...

 {   "130311": 
    {"description":"Environmental Parameters","35_Sea": {"timestamp":"2012-11-22-12:24:03.000","prio":"5","src":"35","dst":"255","pgn":"130311","description":"Environmental Parameters","fields":{"SID":"31","Temperature Instance":"Sea","Temperature":"19.44"}}
    }
 }

JSON caching port returns this...

{   
    "Sea Temperature": "67.5"
    "PNG" : "130311"
    "src":"35"
    "timestamp":"2012-11-22-12:24:03.000"
}

This would allow the app to just drag the name and value for display etc

With enough info left over to allow correlation with the JSON streaming port (if needed).

Thoughts?

analyzer crashes when multiple 129029

Working on a n2k reader that reads raw CAN bus, I tried to inject these messages :

2015-08-28T14:06:27.614Z,0,129029,0,255,8,01,ff,ff,ff,ff,ff,ff,ff
2015-08-28T14:06:27.614Z,0,129029,0,255,8,02,ff,7f,ff,ff,ff,ff,ff
2015-08-28T14:06:27.614Z,0,129029,0,255,8,03,ff,ff,7f,ff,ff,ff,ff
2015-08-28T14:06:27.614Z,0,129029,0,255,8,04,ff,ff,ff,7f,03,fc,00
2015-08-28T14:06:27.614Z,0,129029,0,255,8,05,ff,7f,ff,7f,ff,ff,ff
2015-08-28T14:06:27.614Z,0,129029,0,255,8,06,7f,00,ff,ff,ff,ff,ff
2015-08-28T14:06:27.614Z,0,129540,0,255,8,00,03,ff,ff,00,ff,ff,ff

analyzer crashes :
#7 0x0804d82f in printPacket (index=135, unknownIndex=74, msg=msg@entry=0xbfea02bc) at analyzer.c:2006
#8 0x0804da5e in printCanFormat (msg=msg@entry=0xbfea02bc) at analyzer.c:2153
#9 0x08049507 in main (argc=2, argv=0xbfea0c44) at analyzer.c:461

Is analyzer doing Fast Packet reassembly or should I do it before ?

Thx for this excellent project !

Saturation of the NMEA0183 network

Is it possible to limit the number message going out in time. the network 183 is working at 4800 bds, and saturates very easily.
$WIMWV,156.8,R,016.08,N,A*08, is sent 10 time/sec = 32 x 10 x 10 = 3200 bds
For instance, a GPS can send once per second.

Rate-of-Turn resolution

It appears that the resolution for the rate-of-turn message (PGN 127251) as
supplied in this repository (3.125e-9) is incorrect and off by a factor of ten (it should be 3.125e-8).

I noticed this by differentiating (and slightly smoothing, to make it displayable) the heading data and
comparing it to the rate of turn data. In order to get the two to match, I had to divide the speeds
as derived from the heading data by 10 to get them to match the rate of turn. Because the
rate of turn and heading data are both coming in at 10Hz, it does not seem unreasonable to
assume that there is something particular about a factor of 10 that is causing confusion somewhere,
hence my inclination to believe that the error is exactly a factor of 10 (in fact, I originally erred
and plotted my differentiated heading data without dividing by the 0.1sec dt and so ended
up with the Airmar rate of turn and differentiated data matching perfectly).

Am I missing something obvious, is this a known issue, or is this worth checking further?

I don't have any raw candumps on-hand, although they are easy to get. It is certainly possible
that there is some error in my processing (I log after processing the raw CAN messages),
although given that the heading data and everything else I use is fine, that seems unlikely.

See below for some data, from the Airmar 220WX that I'm using to collect data, in which I
adjust by the factor of 10 and the data matches up reasonably.

airmar_omega

Fallback mechanism for "unknown" PGN entries is unclear

Could someone with a thorough understanding of the code please document what analyzer does when finding an unknown PGN? There are several entries with the unknownPgn field set to true. Any unknown PGN seems to fall back to the "unknown" entry with the highest number less than or equal to its own. However I recall some instances where the fallback went wrong.

I tried to understand what the code does, but it's rather hard to follow. The first step to verify if it's working alright would be to have a clear documentation about the expected order in pgn.h.

  • Should known PGN entries always stand before or after the catch-all ones?
  • Which specific catch-all entry gets used?
  • Is there a difference in behavior whether an entry was found with the correct PGN but mismatched fixed fields, or no matching PGN entry at all?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.