07 June 2009

Packetlogger update

The packetlogger suite (v20090607) can be downloaded here. It still requires a Lawicel CANUSB device to sniff new data from the NMEA 2000 bus, but it is now split into two parts: the actual "sniffer" called canreader.exe that talks to the bus, and a separate analyzer called analyzer.exe.

Both programs operate in UNIX filter style; canreader can only log CAN data to stdout. It runs until a line is entered on stdin. analyzer reads stdin and write analyzed output to stdout.

Analyzer can run without a CANusb present. Without raw N2K log files though the only thing it can do is show what NMEA PGNs and fields therein the program understands.

Here are some typical usage examples:

analyze -explain # Show what PGNs are understood by the program
canreader | analyzer # read data and analyze immediately
canreader > rawnmea.log # write data that can be analyzed at a later date
cat rawnmea.log | analyze -raw -data # interpret file later date, show three stages of interpreted data
cat rawnmea.log | analyze 129038 # focus on single PGN

Here is a link to the output of analyze -explain that shows the current list of supported PGNs.

PGNs that have improved in this release:
  • 127505 - Fluid Level (now complete)
  • 129038 - AIS Class A Position Report (now usable)
  • 129283 - Cross Track Error (one field left to explain)
  • 129794 - AIS Class A Static and Voyage Related Data (now usable, ETA still wrong)
  • 130836 - Simnet: Configure? (understands EP65R configuration data)

3 comments:

  1. Kees,

    I'm very interested in the work you are doing. It's similar to a project I'm about to start. Regarding your logger, is it Lawicel-specific, or are you running on top of the CANUSB serial drivers? I have a Actisense USB-N2K interface that I'd like to try out and was planning on writing my own logging code but I'd definitely prefer to give yours a try if the drivers work in a similar fashion.

    Thanks for posting!

    ReplyDelete
  2. Hi Adam,

    I used the CANUSB DLL which is Lawicel specific. This doesn't matter much as the CAN adapter has to put a protocol on the emulated RS-232 port anyway, and I doubt that Actisense has the same protocol.

    However, since the split this is easy: all you need to do is write your own 'actisensereader' program that interfaces with your Actisense device and spits out formatted bytes on stdout.

    The format that canreader produces and that analyzer requires is:

    timestamp,priority,pgn,source,destination,len,byte,...

    where byte repeats len times (max 8) and contains a hex value. Every line represents a single CAN packet. The analyzer performs Fast Packet concatenation, so all you need to worry about is getting the packets.

    An example of something analyzer can read:

    2009-06-04Z19:58:59.651,6,59904,5,255,3,00,ee,00
    2009-06-04Z19:58:59.651,6,60928,9,255,8,9c,24,30,e8,00,be,a0,c0
    2009-06-04Z19:58:59.651,6,60928,8,255,8,90,f2,97,11,ff,aa,a0,c1
    2009-06-4Z19:58:59.666,6,60928,35,255,8,05,23,e3,10,00,82,78,c0
    2009-06-4Z19:58:59.666,6,60928,10,255,8,b4,0b,32,e8,00,8c,50,c0
    2009-06-4Z19:58:59.682,7,65305,10,255,8,41,9f,00,03,00,00,00,00
    2009-06-04Z19:58:59.682,6,60928,7,255,8,94,0a,3b,e8,00,96,a0,c0
    2009-06-04Z19:58:59.697,6,60928,6,255,8,ca,8a,70,22,00,8c,8c,c0
    2009-06-04Z19:58:59.697,6,60928,0,255,8,66,c6,3a,e8,00,96,50,c0
    2009-06-04Z19:58:59.697,2,130306,0,255,8,ff,00,00,0d,f1,f9,ff,ff

    ReplyDelete
  3. Kees:

    Makes sense. I actually assumed that the N2K bytestream would be put onto the virtual serial bus directly. Is that not the case? You are obviously doing some processing to convert the data stream into your CSV output.

    I'll take a look at the Actisense software on the CD they shipped with the interface. Now I just need a sensor of some kind to generate some data... :)

    /afb

    ReplyDelete