0

I have the following hardware:

The garmin has four wires:

  • red connected to the positive terminal on the battery
  • black connected to the negative terminal on the battery
  • blue (NMEA tx) connected to USB NMEA white (rx)
  • brown (NMEA rx) not connected

The USB NMEA cable has three wires at one end and a male USB at the other:

  • black - ground connected to the negative terminal on the battery
  • white - NMEA rx connected to the Garmin blue NMEA tx cable
  • green - NMEA tx not connected
  • USB - plugged into the RPI (non USB3 port)

I have the following code in a python file:

   import serial
   def init():
     ser = serial.Serial()
     ser.baudrate = 4800
     ser.port = '/dev/ttyUSB0'
     ser.open()

     while True:
       line  = ser.read(1)
       print ord(line)
   init()

When I have the python code running, with the Garmin turned on, I can see data feeding into the application in ticks, but the data is garbled. The following is the output from one tick, I applied ord(line) in order to show the characters which for the most part are invisible or question marks or random nonsensical characters without ord applied.

91
125
197
101
245
157
125
167
157
167
167
167
167
167
167
167
167
167
167
167
167
167
167
167
171
157
117
229
235

If I run the python file just printing ser, i get the following:

Serial<id=0xb67755f0, open=True>(port='/dev/ttyUSB0', baudrate=4800, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)

Troubleshooting I've tried:

  • If I turn the Garmin off, the ticks stop. So I know that it is recieving the signal, just not interpretting it properly.
  • All of the reading I have found says that garbled messages means that the baud rate is wrong. The garmin manuals say that the rate is supposed to be 4800 for NMEA standard. (The Garmin has a setting for NMEA standard or NMEA high speed. I have it set to standard.) I have tried every buad rate under the sun. The garbled characters seem to garble differently, but none of them are useful.
  • Some other suggestions were to try and connect the USB NMEA tx with the rx only, which I did. I then ran the python script and in a seperate window I ran; echo helloworld > /dev/ttyUSB0. This appeared in the terminal running the script. So I'm confident that the USB cable is sending and recieving as expected.

For whatever reason I cannot get ungarbled signal from the Garmin. It should be printing an NMEA sentence.

What am I doing wrong?

1 Answer 1

2

Find out what the actual Garmin baudrate is (using a logic analyzer, e.g. piscope) and configure your cable to use that. Then check that the cable accepts the baudrate you're setting by running your loopback script and checking the baudrate with a logic analyzer. UART converters have limits on min/max baudrate, and some of them will simply use their min baudrate for any value below the limit that you set.

If the data is garbled even on the correct baudrate, you could try a different cable if you have one. Ultimately, if the hardware is not working, there's nothing you can do about it. Get a working GPS receiver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.