Code Monkey home page Code Monkey logo

fdxread's Introduction

FDX reader for Garmin GND10

This is software to read the FDX protocol data seen on the USB port of Garmin GND10 gateways.

The GND10 unit is used on boats and translates between Nexus FDX and NMEA2000.

Installation

fdxread is available from https://pypi.python.org/pypi/fdxread/ and should be installed using pip:

$ pip install fdxread
$ fdxread --help  # Should be in $PATH

Tested on Linux and OS X, with Python 2.7 and Python 3.6. Goal is that it should work laptops and on any raspberry pis out there.

Note that on Debian systems you need to run apt-get install python-dev first for the LatLon23 (dependency) module to install/compile correctly. (at least on my armhf jessie system)

If you don't want to install it globally on the system, you can use a virtualenv like described in the development section below.

Running it

fdxread will read FDX either from a saved file (.dump/.nxb) or from a serial port.

It will send output to the terminal (stdout) on the format configured, normally NMEA0183.

$ fdxread /dev/ttyACM0
$FVMWV,268.64,R,0.06,K,A*20
$ZZXDR,P,102.23000,B,Barometer*25
$SDDBT,,f,4.86,m,,F*1C
[ .. output cut .. ]

fdxread does not require root permissions. It should not be run under sudo. For access to devices in /dev/ the user it runs as should be added to the dialout group. (on Debian/Ubuntu)

There may be parse warnings logged to stderr that clutter the screen. These can be filtered with console redirection as usual: 2>/dev/null

When reading a saved file it is recommended to add "--pace 5" to slow down the output flow. A file for testing can be found in the source repository: https://github.com/lkarsten/fdxread/raw/master/dumps/onsdagsregatta-2016-08-24.dump

$ fdxread --pace 5 onsdagsregatta-2016-08-24.dump | head -10
WARNING:root:No handler for 6 byte 0x020200: 020200000081
$FVMWV,268.64,R,0.06,K,A*20
$ZZXDR,P,102.23000,B,Barometer*25
$ZZXDR,C,22.22,C,TempDir*13
$SDDBT,,f,4.86,m,,F*1C
$SDVHW,0.0,T,0.0,M,0.00,N,0.0,K*72
$FVMWV,268.64,R,0.06,K,A*20
$SDDBT,,f,4.86,m,,F*1C
$SDVHW,0.0,T,0.0,M,0.00,N,0.0,K*72
$FVMWV,262.14,R,1.08,K,A*22
$SDDBT,,f,4.86,m,,F*1C

Using it with OpenCPN and other software

For now the best way of running it is to pipe the output to a NMEA multiplexer using TCP.

I prefer the kplex multiplexer. After installing it, it can be started with: kplex tcp:direction=both,mode=server,address=127.0.0.1,port=10110

You then pipe the output from fdxread into it using netcat: fdxread /dev/ttyACM0 | nc localhost 10110

Some information on how to set up OpenCPN and the Chrome application NMEA Sleuth can be found in #6 .

--help output

usage: fdxread [-h] [--format fmt] [--seek n] [--pace n] [--send-psilfdx] [-v]
               inputfile

fdxread v0.9.1 - Nexus FDX parser (incl. Garmin GND10)

positional arguments:
  inputfile       Serial port or file to read from. Examples: /dev/ttyACM0,
                  COM3, ./file.dump

optional arguments:
  -h, --help      show this help message and exit
  --format fmt    Output mode, default nmea0183. (json, signalk, nmea0183,
                  none, raw)
  --seek n        Seek this many bytes into file before starting (for files)
  --pace n        Pace reading to n messages per second (for files)
  --send-psilfdx  Send initial mode change command to port (for NX2 server)
                  (experimental)
  -v, --verbose   Verbose output

fdxread is used to read FDX protocol data from Garmin GND10 units.

Background information

Everything here is deduced from staring at the arriving bytes while disconnecting some units and motoring in circles. Something was pretty simple to figure out, some other metrics I'm still not sure is right.

Use at your own risk.

On a side note, I believe this is the only open/freely available document on the format of the FDX protocol.

Development

The development happens in git on https://github.com/lkarsten/fdxread/

    $ git clone https://github.com/lkarsten/fdxread.git
    $ cd fdxread
    $ virtualenv --system-site-packages venv
    $ . venv/bin/activate
    $ pip install -r requirements.txt

License

The contents of this repository is licensed under GNU GPLv2. See the LICENSE file for more information.

Copyright (C) 2016-2017 Lasse Karstensen

fdxread's People

Contributors

lkarsten avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fdxread's Issues

Fdxread and Openplotter integration

I wrote for me an Openplotter tool to integrate easyly Fdxread.
This small tool can be run automatically at Opentool startup, integrate it for non-geeks and it feeds the Openplotter system with NMEA output via UDP for these first version.

I had hesitations to integrate directly Fdxread SignalK output because I don't know if the quality is equivalent to NMEA. @lkarsten what is your opinion ?

@lkarsten , if you agree and other users are interested , I can push this tool to the Openplotter source site with your references.
It can be interesting to gain new test users.

GPS position formatting error

Reported by @first317 on slack.

$GPGLL,546.144,N,1048.4669,E,183425,A,,*15
$GPGLL,546.144,N,1048.4669,E,183426,A,,*16
$GPRMC,183427,A,546.144,N,1048.4669,E,0.04,269.65,070117,0.0,E,*6D
$GPHDT,269.65,T,*27
$GPGLL,546.144,N,1048.4669,E,183427,A,,*17

which decodes to (with https://rl.se/gprmc )

Position 5.769067°N 10.807782°E
Timestamp Sat, 7 Jan 2017 18:34:27 UTC
Close to Foumban, Cameroon
Local time Sat, 7 Jan 2017 19:34:27 WAT
Timezone Africa/Douala (UTC +0100)

Expected: (i think) somewhere in Germany.

GND10read and kplex

I usually run a kplex TCP server on port 10110, and pipe the output from nmeaformat.py to it using netcat.

Could you explain, how do you use this?

I'm trying this without success
my kplex.conf

[udp]
name=system_input
direction=in
optional=yes
address=127.0.0.1
port=10110

[tcp]
name=system_output
direction=both
mode=server
port=10110

It works fine with tcp and udp
cat mynmea.log | nc 127.0.0.1
cat mynmea.log | nc -u 127.0.0.1

But it doesn't work if using
./olddumpformat.py dumps/onsdagsregatta-2016-08-17.dump | ./fdxdecode.py | ./nmeaformat.py 2>/dev/null | nc 127.0.0.1 10110

Regards
free-x

Hemisphere is incorrect

Testing using a Nexus log file from cruising west cost of Scotland, so Longitude is 005'46.290W
fdxread outputs location correctly except shows as 005'46.290E, that is East instead of West.

lexer should know frame lengths

Currently the lexer looks for a single 0x81 and produces messages based on that. This is a bit crude.

$ ./fdxread --format raw dumps/onsdagsregatta-2016-08-17.dump 2>&1 1>/dev/null| head -10
WARNING:root:mtype=0x010405: Incorrect length 9 (got 8.0) body: 7f01708f81
WARNING:root:mtype=0x010405: Incorrect length 9 (got 6.0) body: 370181

Looking up the hex sequence of the first warning, finding this line in onsdagsregatta-2016-08-17.dump:
1471447636.547 42 01 04 05 7f 01 70 8f 81 81 11 02 13 [.. cut]

The 0x010405 message's last octet is 0x81, which is mistaken for a message delimiter. The next message is just the 0x81 (1 octet) and is skipped.

Solution here is to have a smarter fdx reader that recognises the 3 byte frame type and then consumes the correct number of octets.

FDXread on openplotter errors

Hello

I'm trying to use FDXread on openplotter to connect my wsibox.

I have errors when I perform the test procedure and nothing appears on the nmea console of openCPN.

Thank you for your help.

fdxread ~/fdxread/dumps/onsdagsregatta-2016-08-17.dump | nc localhost 10110
WARNING:root:mtype=0x010405: Incorrect length 9 (got 8) body: 7f01708f81
WARNING:root:mtype=0x010405: Incorrect length 9 (got 6) body: 370181
WARNING:root:mtype=0x120416: Incorrect length 9 (got 8) body: 1501099c81
WARNING:root:mtype=0x120416: Incorrect length 9 (got 6) body: c70081
WARNING:root:mtype=0x010405: Incorrect length 9 (got 6) body: 290181
WARNING:root:mtype=0x010405: Incorrect length 9 (got 6) body: 290181
WARNING:root:mtype=0x010405: Incorrect length 9 (got 8) body: 0201159781
WARNING:root:mtype=0x120416: Incorrect length 9 (got 6) body: 090181
WARNING:root:mtype=0x210425: Incorrect length 9 (got 8) body: a300230181
WARNING:root:mtype=0x010405: Incorrect length 9 (got 6) body: d10081

Feature: port mode change for NX2 server

The NX2 server starts up with its serial interface in NMEA0183 mode at 4800 baud.

By sending a special NMEA0183 message ( it can be configured to run at 19200 baud.

Another NMEA0183 message will reconfigure the port from NMEA0183 to FDX.

Status:

  • Support for mode change into FDX was added in 73df855 with "--send-psilfdx", but is so far untested on real hardware. Depending on if the NX2 server is reading the data, multiple restarts of fdxread with this option may lead to blocking writes, I don't know. Serial ports are finicky things.

  • Changing the data rate isn't added yet. I'm not sure if we need it. I can think of a whole lot of edge cases when this speed change is happening, especially if we are changing mode to FDX almost at the same time. With some luck this complexity can be avoided. (Q: does mode change to FDX also change the port speed? Will --send-psilfdx need to close/reopen the port to get going again?)

Q: gWind Wireless 2 Transducer

Hello,

this is a long shot but I'm wondering if you have any information about the gWind Wireless 2 Transducer's protocol and how open or closed it is? It's supposedly using ANT for signaling and I'm looking to replicate something along the lines of a GNX Wind Instrument on an Android device. Wouldn't want to spend the money on the gWind if it's hopeless.

Thanks!

Feature: populate NX2 waypoints from GPX

Inputing waypoints into the NX2 race computer through Nexus Race is painful and slow.

It should be possible to supply a GPX file (or similar) and have it translated into FDX and sent over the bus.

Prerequisite for this to understand the configuration format used. Read before talking, walk before running and all that.

Sample dumps like dumps/set1_*.dump and dumps/set2_*.dump did for wind speed/direction will be required. Small dumps that: 1) reset/delete a waypoint using Nexus Race, 2) insert a waypoint number n at a known position.

GPX and formatting the FDX message will be trivial when we know how.

Currently blocked on more data. Input welcome.

Not working with python2 (Was: MACOS Sierra)

I just installed the software on MACOS Sierra version 10.12.3.
I had a first test with ./fdxread dumps/gnd10-and-displays.dump

I have a lot of messages like WARNING:root:Ignoring exception: missing tailer.

I tried also the testall program and it is the same.
A CR/LF trouble ?

Thanks for your help

no Windspeed

Hej Lasse,
i testet now the script about 1,5 Month and it works fine!
No Connection drops.
My Problem is, if i try to make a nmea instrument Panel in OpenCPN ore NMEA Sleuth, there is only the Winddirection and not the speed.

Nexus network connection (WSI Box)

I made yesterday a first try to connect my Mac to Nexus network

On the boat
I have a WSI box (pack 4)
I have my Mac (Sierra)
I have a serial cable for RS-485 (Cf. link)
For easy access, I connect my cable to White and Yellow plugs in parallel behind the Sea Data instrument and first I have errors on the instruments.
I switched the 2 cables (White=DataB=TDX- Yellow=DataA=TDX+ ) and then no error and my cable RDX led detect traffic.
I run a small nodejs program to capture traffic and dump it in your Fdxread dump format.
I seems to work but with many long sentences...
In parallel, I read and snap the basic values : AWA,AWS,BSP,RSI,DPT,BAT,TMP,hPA

I configured with 8-N-1 serial definition (1 start bit, 8 data bits, 1 stop bit, No parity) and 9600 bds.

At home
I see that the sentences are not good, too longs and first bytes not good.

Next week I will test more because I will have more time.
I will try parity changes and will check also with programs fdxread and serial2dump.

91oowfnyjwl sl1500

Not seeing wind data from included dumps

Hi,

I have installed fdxread, kplex, nema slueth and opencpn on a single machine.

When reading back the various dump files included in this repo, I do not see any wind data being parsed.

Is this an expected behaviour?

PS. I see this project is no longer maintained. I am a python programmer with access to a Nexus NX2 system and would be interested in picking up this project.

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.