Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced GPS detection and MTK3339 support #315

Closed
ghost opened this issue Mar 9, 2016 · 84 comments
Closed

Enhanced GPS detection and MTK3339 support #315

ghost opened this issue Mar 9, 2016 · 84 comments

Comments

@ghost
Copy link

ghost commented Mar 9, 2016

  1. Stratux version: v0.8r1 https://github.com/AvSquirrel/stratux/commit/fd936e7e1b71429abb4e853f8a7116078a3da718

  2. Stratux config:

    SDR
    [ ] single
    [X] dual

    GPS
    [X] yes
    [ ] no
    type: u-blox, MTK, or SIRF

    AHRS
    [X] yes
    [ ] no

    power source: Wall-wart
    usb cable: Fixed

  3. EFB app and version: N/A
    EFB platform: N/A
    EFB hardware: N/A

  4. Description of your issue:

Multiple users are using or have requested support for MTK3339-based GPS receivers (e.g. Adafruit Ultimate GPS). These receivers will work on current builds if connected through a USB-to-UART bridge since ttyUSB0 is assumed to be SIRF IV (BU-353), which only outputs standard NMEA sentences.

Devices that connect as ttyACM0 (u-blox native USB interface) or ttyAMA0 (onboard UART) are assumed to be u-blox, and are configured to use UBX-proprietary NMEA sentences for efficiency and improved quality / resolution of data over standard NMEA. However, this means that Stratux tries to configure any device on ttyAMA0 as if it were a u-blox device, and this makes UART connections incompatible with any other type of GPS receiver.

This is a tracking request for improving the GPS configuration routine to better autodetect these alternate receivers. I'm starting to lay this out in my development branch but have a few open questions:

  • Besides the Adafruit Ultimate GPS, the BU-353 (and other SIRF receivers), and the various u-blox devices, are there any other common receivers that should be supported?
  • What baud rates are these factory-configured to use? Should Stratux attempt to autobaud through other rates to handle user configuration / misconfiguration?
  • Should the UI provide for manual (specify type of device, port -- e.g. /dev/ttyUSB3, and baud rate) or semi-manual (specify type of device and method of connection -- e.g. GPIO or USB) overrides to speed up "difficult" cases?
@ghost ghost added the enhancement label Mar 9, 2016
@ghost ghost added this to the v0.9 milestone Mar 9, 2016
@ghost
Copy link
Author

ghost commented Mar 9, 2016

Devices that connect as ttyACM0 (u-blox native USB interface) or ttyAMA0 (onboard UART) are assumed to be u-blox, and are configured to use UBX-proprietary NMEA sentences for efficiency and improved quality / resolution of data over standard NMEA. However, this means that Stratux tries to configure any device on ttyAMA0 as if it were a u-blox device, and this makes UART connections incompatible with any other type of GPS receiver.

On second thought, that doesn't really make sense. The UBX configuration routine opens ttyAMA0 at 9600 baud, writes a bunch of binary messages to set up message rate, message configuration, dynamic model, and finally, a message to set the GPS bitrate to 38400 baud. The ttyAMA0 port is then closed and reopened at 38400 baud to start reading messages. As long as the binary messages don't mess things up, any device that's hardcoded to 38400 should work on existing code.

@skypuppy
Copy link

skypuppy commented Mar 9, 2016

AvSquirrel, some of us have run out of USB ports when keyboard and mouse
are connected. :)
Using a powered hub (while at home) helps that condition. However, the
radios are soooo big, you can't hardly put anything else on those 4
ports, with the teeny wifi just barely fitting when you use 2 radios.
So my mtk3339 gps is connected to the serial ports in all my tests.
If you guys have determined the best/most reliable baud rate and it's
not 9600 (default), I can look up the command to send to the GPS to
change it's baud rate. Someone else already posted it, too.
If you need the docs for it, there is a good link on the adafruit
Ultimate GPS page.

One huge advantage of the Adafruit version is you can add a battery to
the gps board and set the system clock from the rtc in the gps during
the RPi bootup. That battery also helps the gps find itself very
quickly provided it hasn't moved too far since it was shutdown. I have
the battery on both of mine.

I have written small pieces of software testing these very things
(except setting system time.) However, not being familiar with ublox, I
have not tackled the current source code to NOT use ublox and to use
standard nmea strings.

I also have a USB (sirf? I forget) gps from an old Micro$loth Streets
and Trips package, but stratux does not like it either.

Most of my time right now is trying to get the BNO055 AHRS to play nice
with current stratux software. Still having difficulty getting stratux
source to compile and run.

Skypuppy

On 03/08/2016 11:52 PM, AvSquirrel wrote:

  1. Stratux version: v0.8r1 AvSquirrel@fd936e7
    https://github.com/AvSquirrel/stratux/commit/fd936e7e1b71429abb4e853f8a7116078a3da718

Stratux config:

SDR
[ ] single
[X] dual

GPS
[X] yes
[ ] no
type: u-blox, MTK, or SIRF

AHRS
[X] yes
[ ] no

power source: Wall-wart
usb cable: Fixed
EFB app and version: N/A
EFB platform: N/A
EFB hardware: N/A
Description of your issue:

Multiple users are using or have requested support for MTK3339-based
GPS receivers (e.g. Adafruit Ultimate GPS). These receivers will work
on current builds if connected through a USB-to-UART bridge since
ttyUSB0 is assumed to be SIRF IV (BU-353), which only outputs standard
NMEA sentences.

Devices that connect as ttyACM0 (u-blox native USB interface) or
ttyAMA0 (onboard UART) are assumed to be u-blox, and are configured to
use UBX-proprietary NMEA sentences for efficiency and improved quality
/ resolution of data over standard NMEA. However, this means that
Stratux tries to configure any device on ttyAMA0 as if it were a
u-blox device, and this makes UART connections incompatible with any
other type of GPS receiver.

This is a tracking request for improving the GPS configuration routine
to better autodetect these alternate receivers. I'm starting to lay
this out in my development branch but have a few open questions:

  • Besides the Adafruit Ultimate GPS, the BU-353 (and other SIRF
    receivers), and the various u-blox devices, are there any other
    common receivers that should be supported?
  • What baud rates are these factory-configured to use? Should
    Stratux attempt to autobaud through other rates to handle user
    configuration / misconfiguration?
  • Should the UI provide for manual (specify type of device, port --
    e.g. /dev/ttyUSB3, and baud rate) or semi-manual (specify type of
    device and method of connection -- e.g. GPIO or USB) overrides to
    speed up "difficult" cases?


Reply to this email directly or view it on GitHub
#315.

@cyoung
Copy link
Owner

cyoung commented Mar 9, 2016

Increasing hardware support increases the code maintenance cost - so what would be the benefit of supporting MTK3339 over the Vk-172? The only boards I'm finding are breakout boards and they're even more expensive than the Vk-172.

@skypuppy
Copy link

skypuppy commented Mar 9, 2016

I believe I enumerated the benefits, mainly, the battery backup rtc to

  1. set the RPi time -of-day and 2) much faster initial fixes.

On 03/09/2016 07:30 AM, cyoung wrote:

Increasing hardware support increases the code maintenance cost - so
what would be the benefit of supporting MTK3339 over the Vk-172? The
only boards I'm finding are breakout boards and they're even more
expensive than the Vk-172.


Reply to this email directly or view it on GitHub
#315 (comment).

@cyoung
Copy link
Owner

cyoung commented Mar 9, 2016

Not sure, looks like everything is extra with these breakout boards. The Vk-172 gets a pretty fast lock (unlike the RY835AI in certain situations). We're dealing with GPS time whenever we get it and any "real time" dependent functions for us are just informational, so the rtc isn't worth much at this point in time.

Given the fact that it's a breakout board for twice the cost of a reliable USB device, I'd say that this product is inferior for our uses.

Vk-172 or BU-353-S4 offer the same things for less, and the only benefit the BU-353-S4 has AFAIK is the ability to place it remotely.

@Ergonomicmike
Copy link

The BU-353 has a super-capacitor inside. I don't know if it keeps a clock running, but it does keep something alive for a day or so that allows acquisition in a few seconds. Even when it forgets and has to do a cold start, it takes only a few minutes. (Not the hours some were reporting with the RY835ai.)

I don't have a VK-172 to compare to, but I would like to think that the BU-353 pulls signals in better due to it's large ground plane/shield for its antenna.

@ghost
Copy link
Author

ghost commented Mar 11, 2016

Thanks for the feedback, guys.

Prototype support for the Adafruit Ultimate GPS (MTK3339) over UART is in my experimental branch as of commit https://github.com/AvSquirrel/stratux/commit/31872c23a6722745d550b34de4d825907196242d . Since I don't have the Adafruit hardware, I'm going exclusively by the MTK NMEA protocol guide. (In theory, it should work if I didn't mess anything up, but it would be nice to have hardware to test on.)

Upgrade package:
update-stratux-v0.8r1-31872c23a6.sh.zip

Usual caveats about my new / experimental features apply.

For now, I'll keep things simple with support for the following:

  • U-blox 6/7/8 over USB (rate will autobaud; device will autoconfig)
  • U-blox 6/7/8 over /dev/ttyAMA0 (need to be preset to 9600 baud; device will autoconfig)
  • SIRF IV over USB bridge on /dev/ttyUSB0 from @iposva 's commits
  • MTK3339 over UART (need to be preset to 9600 baud; device will autoconfig) [Needs testing].

Additionally, the following devices should be compatible:

  • Any other generic GPS over UART (needs to be preset to 9600 baud, and sending GGA, RMC, and GSA messages at 1-2 Hz to avoid saturating the connection)
  • U-blox or MTK3339 over UART, pre-configured to use 38400 baud (e.g. users who want to test alternate GNSS systems or otherwise).

@cyoung -- not disagreeing with you that the VK-172 is a better deal, but the Adafruit hardware seems to be relatively common in the RPi community. The Mediatek chipset uses NMEA commands for configuration, and it can be positively identified by using a NMEA query. Building the prototype was relatively easy. I'm mindful of scope creep, but the added complexity for that receiver was minimal. The MTK support code coexists peacefully with my u-blox M8N,

I've come around on the VK-172 in a big way the last couple of months. It's a very competent implementation of a very capable chipset. I see better than 2 meter accuracy in the air, with position acquisitions from cold start (i.e. after clearing almanac and RTC) in under two minutes. Clock gets set within 15 seconds of cold start. Warm starts (unplugging / replugging) are faster. To be honest, I've found that the backup battery doesn't really matter at startup, as long as you have a clear view of the sky and keep the antenna away from any noise emitters. For $20, it's an incredible value.

Moreover, it's a dream to develop for. The u-blox documentation is clear and complete, the extended NMEA sentences give us all of the position and state information we'd ever need, using the binary protocol to issue commands is reasonably easy to use, and it has native USB support! There's no bridge chip: it actually identifies itself to the system as "u-blox", and it autobauds!

All that said, these little units went scarce for a while, and folks like @Ergonomicmike bought up the BU-353-iv since it was available on Amazon, could be remote-mounted easily, and since it had a pretty solid reputation for its RF selectivity. @Helno shared some teardown pictures on reddit and Slack that showed excellent shielding -- although this video teardown shows a bare green board with a tiny patch antenna.

@cyoung
Copy link
Owner

cyoung commented Mar 11, 2016

Yeah, these two work pretty well. It's not just scope creep but making the hardware profile further fragmented is just not a good move. Some people might get the idea that Stratux is an ADS-B receiver that you make out of components that are laying in your spare parts bin. A lot of people complained that Pi B+ or other WiFi controllers were not supported. Can you imagine figuring out the WiFi issues, some of the system reboot/lockup issues we've encountered and fixed in the past, or even routine code issues if we don't know which of the four configurations of the core system they are using? Or even care, because I personally will not be running tests on four different Raspberry Pis to get things working. It adds unnecessary complexity for no value. The only selling point on this GPS is that more people have it in their spare parts bin. Well, I don't and you don't. This is a more expensive chip that offers nothing above the two completely acceptable options we have.

@peepsnet
Copy link
Contributor

I would at least have a few options available for out of stock and discontinued products. I believe the project has done a great job of that!

Keeping it open source means if they want ala carte they can do it themselves.

@skypuppy
Copy link

AvSquirrel, I have a (larger) proto board with the Adafruit Utimate GPS on iit that you could borrow to play with but I'd want it back. Where on Earth are you? (you have to be on Earth to get GPS.)

Alternatively, we could go to private email or phone to do some of the test here on my machine.

Skypuppy

@aerojoe
Copy link

aerojoe commented Mar 13, 2016

Hi Guys,
I've not tested the .8r1 version above with the Adafruit. But here is what I found with v .7b3. It seems that something is closing the AMA0 device on my Pi as soon as it's opened. This is why some NMEA messages get through, but most do not. I shutdown the gdl process on the Pi when doing this test, so I don't think there is anything in Stratux that is closing this port. I'll update to the version above tomorrow and repeat my tests and will report back.
Joe

@skypuppy
Copy link

In jessie with 0.8r1, you can run "minicom" or better, "cutecom" and
watch the mtk3339 (Adafruit Ultimate GPS) and see it is still producing
data to the serial port, non-stop. It is really easy to watch with
"cutecom." sudo apt-get update, sudo apt-get install cutecom. The
power-up defaults on the mtk3339 are 9600, n81, on tty AMA0 (that is a
zero.)
Stratux code is NOT seeing the standard NMEA sentences from tty AMA0.
However, if you connect a SIRF chipset to it via USB, then stratux
recognizes standard NMEA and works and, at least on the stratux web UI,
shows DGPS (SBAS/WAAS) when you get enough sats in view (4 or more.)

:
That works with or without gpsd running. So far, I've not gotten gpsd
to cooperate whether stratux is running or not.

"Cutecom" has a much easier UI than "minicom.

Do y'all know of any other gps watcher besides "gpscon" that tries to
present the NMEA strings in an interpreted form format? "Gpscon"
doesn't cooperate on the Rpi2, either, with or without gpsd.

I STILL cannot figure out that u-blox thang, to be able to autodetect
which gps is running and configure for it inside stratux.

Skypuppy

On 03/12/2016 09:05 PM, aerojoe wrote:

Hi Guys,
I've not tested the .8r1 version above with the Adafruit. But here is
what I found with v .7b3. It seems that something is closing the AMA0
device on my Pi as soon as it's opened. This is why some NMEA messages
get through, but most do not. I shutdown the gdl process on the Pi
when doing this test, so I don't think there is anything in Stratux
that is closing this port. I'll update to the version above tomorrow
and repeat my tests and will report back.
Joe


Reply to this email directly or view it on GitHub
#315 (comment).

@skypuppy
Copy link

Also, to stop (almost) all of stratux, use "service stratux stop" and
"service stratux start" when you want to fire it up again.

Skypuppy

On 03/12/2016 09:05 PM, aerojoe wrote:

Hi Guys,
I've not tested the .8r1 version above with the Adafruit. But here is
what I found with v .7b3. It seems that something is closing the AMA0
device on my Pi as soon as it's opened. This is why some NMEA messages
get through, but most do not. I shutdown the gdl process on the Pi
when doing this test, so I don't think there is anything in Stratux
that is closing this port. I'll update to the version above tomorrow
and repeat my tests and will report back.
Joe


Reply to this email directly or view it on GitHub
#315 (comment).

@aerojoe
Copy link

aerojoe commented Mar 13, 2016

Skypuppy, Yes, I've seen the same behavior with NMEA over ttyAMA0. I'm using cutecom to do diagnostics. I think some other events outside of stratux are causing the serial port to close once it's opened. I also saw that the stratux log would show continual opening of the ttyAMA0 device, which might mean it's being closed more than once. Additionally, with version .8r1, I see that with both the RX and TX lines connected between the Pi and Adafruit, Stratux will not boot up with Wifi or Ethernet working. This was the same issue I saw on v .7r3

I'll dig some more tomorrow.
Joe

@skypuppy
Copy link

aerojoe,

re not working with other hardware powered-up indicates a power supply
problem somewhere.

re stratux log: were you running cutecom at the same time you were
running stratux? If cutecom showed good NMEA messages the whole time
that stratux is showing open/close attempts, to me that indicates a
problem in 1) stratux code, or 2) linux not setting the port as
shared/shareable. If #2, that is one problem a daemon like gpsd would
probably solve. However, that problem is only important during
diagnostic times like now and is not needed for stratux in the
airplane. :) But we still gotta get through this diagnostic and
development time to --make it work!--

I will try again here at home and insert another computer/rs232-checker
and see if #2 is the problem.
That said, cyoung has indicated he is not in favor of changing the
stratux code to accommodate more hardware due to the programmer
overhead. I can respect that but I'm still going to make the mtk3339
work with my stratux box but use the SIRF via USB in the meantime. But,
even with git, it is hard (for me) to maintain my little separate code
while keeping all the other code up-to-date with everyone else's efforts.
AvSquirrel is trying to do this as well but he doesn't have the mtk\3339
hardware. Hope we get it ironed out soon because I am convinced we need
the actual time-of-day that the mtk unit can supply during the RPi2 boot
procedure.

Skypuppy

On 03/13/2016 12:43 AM, aerojoe wrote:

Skypuppy, Yes, I've seen the same behavior with NMEA over ttyAMA0. I'm
using cutecom to do diagnostics. I think some other events outside of
stratux are causing the serial port to close once it's opened. I also
saw that the stratux log would show continual opening of the ttyAMA0
device, which might mean it's being closed more than once.
Additionally, with version .8r1, I see that with both the RX and TX
lines connected between the Pi and Adafruit, Stratux will not boot up
with Wifi or Ethernet working. This was the same issue I saw on v .7r3

I'll dig some more tomorrow.
Joe


Reply to this email directly or view it on GitHub
#315 (comment).

@aerojoe
Copy link

aerojoe commented Mar 13, 2016

skypuppy,

Thanks for the input. I did not know that I could use cutecom to access AMA0 at the same time that Stratux was using it. Now I've tested the AMA0 device both with stratux running and gdl90 killed and the results are similar. When I ran tests on .8r1, more messages seem to get through. In fact, the GPS status page showed 3D position for a brief time. However a short time later some data was lost and then the port was reconfigured to another baud rate, so the messages were garbled. I have the Adafruit set at 38k, and it does not look like any autoconfiguration is taking place on the Adafruit.

Regarding your comment on the bootup problem being related to the power supply, I'm not so sure about this. What I see is that if I disconnect one of the TX or RX lines to the GPIO only (power to the Adafruit is still on), then the Stratux boots correctly. If you don't see the same issue, then it might be an issue with my Pi. I am using the AC/DC power supply and not battery power.

Lastly, I'm not trying to change the direction of the stratux roadmap. You all have done such great work. My motivation to use the Adafruit was largely to have a compact (no USB or external antenna) and ubiquitous GPS module. The VK-172 and RY835, while robust don't seem to be easily available. I also think that modularity and portability are important. Rather that do all of this autoconfiguration for features, perhaps one day the user could configure Stratux options via the web interface. For example, pick your GPS/attitude module, pick your preferred EFB application, etc. I realize the team has to get stability in the basic features first, so these things would be lower priority, nice-to-have features.
aerojoe

@aerojoe
Copy link

aerojoe commented Mar 13, 2016

Update. I stopped stratux and ran my tests again using Cutecom. Again I see the port being closed. I blindly kept opening the port about 10 times and viola, the NMEA sentences starting flowing consistently. Now to find out who or what is closing the device.

@aerojoe
Copy link

aerojoe commented Mar 13, 2016

Sorry, I reread my statements and did not mean to imply the VK-172 is not available. My desire is to have an easily available module that does NOT require USB. The only issue I see with the 172 is that the USB attachment, while compact does not seem to be robust (admittedly solved with some epoxy).

@skypuppy
Copy link

Just so I'm not misunderstood, I am an avid supporter of using the
Adafruit GPS in the stratux.

On 03/13/2016 11:26 AM, aerojoe wrote:

skypuppy,

Thanks for the input. I did not know that I could use cutecom to
access AMA0 at the same time that Stratux was using it. Now I've
tested the AMA0 device both with stratux running and gdl90 killed and
the results are similar. When I ran tests on .8r1, more messages seem
to get through. In fact, the GPS status page showed 3D position for a
brief time. However a short time later some data was lost and then the
port was reconfigured to another baud rate, so the messages were
garbled. I have the Adafruit set at 38k, and it does not look like any
autoconfiguration is taking place on the Adafruit.

Regarding your comment on the bootup problem being related to the
power supply, I'm not so sure about this. What I see is that if I
disconnect one of the TX or RX lines to the GPIO only (power to the
Adafruit is still on), then the Stratux boots correctly. If you don't
see the same issue, then it might be an issue with my Pi. I am using
the AC/DC power supply and not battery power.

Lastly, I'm not trying to change the direction of the stratux roadmap.
You all have done such great work. My motivation to use the Adafruit
was largely to have a compact (no USB or external antenna) and
ubiquitous GPS module. The VK-172 and RY835, while robust don't seem
to be easily available. I also think that modularity and portability
are important. Rather that do all of this autoconfiguration for
features, perhaps one day the user could configure Stratux options via
the web interface. For example, pick your GPS/attitude module, pick
your preferred EFB application, etc. I realize the team has to get
stability in the basic features first, so these things would be lower
priority, nice-to-have features.
aerojoe


Reply to this email directly or view it on GitHub
#315 (comment).

@skypuppy
Copy link

check solder joints, broken wires, etc.

On 03/13/2016 11:32 AM, aerojoe wrote:

Update. I stopped stratux and ran my tests again using Cutecom. Again
I see the port being closed. I blindly kept opening the port about 10
times and viola, the NMEA sentences starting flowing consistently. Now
to find out who or what is closing the device.


Reply to this email directly or view it on GitHub
#315 (comment).

@ghost
Copy link
Author

ghost commented Mar 13, 2016

@aerojoe

To clarify, are you on the v0.8r1 release (build 796d0a2), or on one of the experimental builds? Can you make sure that you have "Record Logs" turned on and post copies of stratux.log and one of your nnnn-gps.log files to review?

GPS config on /dev/ttyAMA0 goes through the following steps as of the v0.8r1 release:

  1. Stratux determine if there is any device attached on /dev/ttyUSB0 (e.g. BU-353 receiver) or /dev/ttyACM0 (e.g. USB u-blox device)
  2. If not, Stratux assumes a u-blox device connected on /dev/ttyAMA0.
  3. /dev/ttyAMA0 is opened at 9600 baud
  4. Binary configuration for u-blox is sent, including a command to set the GPS buad rate to 38400 baud.
  5. /dev/ttyAMA0 is closed, then reopened at 38400 baud.
  6. If no valid NMEA messages are seen within five seconds, the GPS configuration routine is restarted.

First thing I'd want to check is if the MTK3339 is "holding" the 38400 baud setting when you connect it. If it actually powers on at 9600 baud, it will just loop through the initialization every five seconds on the v0.8r1 796d0a2 release. If you're running an experimental build, it's also possible that I don't have something set right in the configuration.

WITHOUT Stratux running, my usual diagnostics for quick connections checks has been to use stty to set baud rate, and cat to read the connection. E.g. to read the port at 9600 baud:

stty -F /dev/ttyAMA0 9600
cat /dev/ttyAMA0

With two SSH sessions open, I've been able to run cat in one and iterate through different stty settings in the other. You could even run stty in a second console while gen_gdl90 is running (e.g. immediately after GPS initialization) to force the port to a specific baud rate.

@ghost
Copy link
Author

ghost commented Mar 13, 2016

By the way, this:

What I see is that if I disconnect one of the TX or RX lines to the GPIO only (power to the Adafruit is still on), then the Stratux boots correctly.

sounds like a possible hardware problem. I agree with @skypuppy -- check your wiring for shorts!

@ghost
Copy link
Author

ghost commented Mar 13, 2016

@skypuppy

AvSquirrel, I have a (larger) proto board with the Adafruit Utimate GPS on iit that you could borrow to play with but I'd want it back. Where on Earth are you? (you have to be on Earth to get GPS.)

That would be very helpful. (I'm in Minnesota.) Send me a PM on reddit and we can work out the details.

@aerojoe
Copy link

aerojoe commented Mar 13, 2016

@skypuppy
I have used the update posted above and the stratux status screen shows version 0.8r1. I do see the stratux trying different baud rates and see messages output that a valid NMEA sentence is recognized. This is only after I reopen AMA0 via cutecom about a dozen times. I know the Adafruit is set to 38.4k and does not change. I'll repeat the tests later today and then post some uncluttered log files so you can see the results. It will be easier to isolate this problem by removing the autorecognition/reconfig code on AMA0. I will also reinstall v0.7b3 (which does not modify the AMA0 baud) to see if that helps isolate the issue.

Lastly, I did shutdown stratux and let Cutecom monitor AMA0. I saw a nice stream of NMEA messages for about 5 minutes. Then mysteriously the baud rate changed and I saw garbage output. Are you able to see any NMEA sentences with the Adafruit on AMA0?

I'll check my wiring and grounds, but it's only 4 wires and the soldered pins, which on the Adafruit are the same ones used in the TTL-USB connection.

@skypuppy
Copy link

Yes, standard NMEA sentences come through just fine from the Pi, with
one exception: while stratux is running, I get garbage occasionally at
38.4 kbaud but never at 9600. Should not be a problem as long as when
the checksum doesn't match, that "sentence" is discarded. This is still
at the 1hz rate, so I need to test iit from 10hz to 0.10hz and see how
many bad sentences come through. I'll have to write a small program to
do that and check with and without stratux running. I should also vary
the baud rates and record these things so I can make a graph.
Then, run the same series of tests on the USB SIRF and see what happens.
This will take a few days to write the program, then I'm guessing
several days for the tests to run reliably. I don't have a ublox gps so
can't test one of those. If anyone else wants to try it with their
ublox just let me know and I'll send you the source, then we can put
that data into the graph.

Ideally, they will all show zero dropped sentences and then we can
confidently announce that the Pi can handle any baud rate with either
interface. :)

Skypuppy

On 03/13/2016 02:03 PM, aerojoe wrote:

@skypuppy https://github.com/skypuppy
I have used the update posted above and the stratux status screen
shows version 0.8r1. I do see the stratux trying different baud rates
and see messages output that a valid NMEA sentence is recognized. This
is only after I reopen AMA0 about a dozen times. I know the Adafruit
is set to 38.4k and does not change. I'll repeat the tests later today
and then post some uncluttered log files so you can see the results.
It will be easier to isolate this problem by removing the
autorecognition/reconfig code on AMA0. I will also reinstall v0.7b3
(which does not modify the AMA0 baud) to see if that helps isolate the
issue.

Lastly, I did shutdown stratux and let Cutecom monitor AMA0. I saw a
nice stream of NMEA messages for about 5 minutes. Then mysteriously
the baud rate changed and I saw garbage output. Are you able to see
any NMEA sentences with the Adafruit on AMA0?

I'll check my wiring and grounds, but it's only 4 wires and the
soldered pins, which on the Adafruit are the same ones used in the
TTL-USB connection.


Reply to this email directly or view it on GitHub
#315 (comment).

@ghost
Copy link
Author

ghost commented Apr 1, 2016

I've been playing with the Adafruit for about a week now (thanks again @skypuppy !) and I'm getting a better handle on its idiosyncrasies.

Likes:

  • Most configuration options can be set by writing NMEA sentences. That means I can easily test with minicom, and the Stratux code is a bit more readable. Both are very handy for development, even if they're not useful to the end user.
  • Battery-backed RTC is accurate and correct immediately after a cold reset (even if current Stratux codebase doesn't support it)
  • External antenna option could be useful for some users

Dislikes:

  • No additional reporting capability beyond the standard NMEA sentences.
  • $40 pricetag is awfully steep for a receiver that only supports a single GNSS. It's old-ish tech, with a capability set on par with a u-blox 6 chipset. A product like this is basically the same feature set, except at less than half the price.
  • It handles MTK NMEA commands nicely. It rejects non-conforming NMEA sentences nicely. Why, then must it spout a line of garbage if I send it properly formed / checksummed NMEA sentences that it doesn't understand? Example: I send $PUBX,00*33, which would tell a u-blox receiver to give me a PUBX,00 position message. The MTK chipset returns "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ" with no CR/LF at the end, so the next message also gets messed up. This can be problematic during the detection routine. Cmon, Mediatek. You're a GPS, not a Finnish speed metal band.

Disappointments:
For as much as its proponents play up its "-165 dBm" sensitivity, the Adafruit Ultimate GPS is weaker than my RY835AI in bench testing, and possibly weaker than my VK-172. The antenna is tiny, and it seems to take longer (4-5 minutes) than my u-blox receivers to achieve position lock from a cold start. To put some numbers on it, here's a side-by-side comparison (literally -- they're sitting a foot apart on the same windowsill) with the RY835AI. On average, the Adafruit saw signal levels about 4 dB-Hz lower than the u-blox M8N implementation on the RY835AI.

image

@ghost
Copy link
Author

ghost commented Apr 1, 2016

@aerojoe, @cyoung -- the leap second is about the corneriest of corner cases that we'd ever deal with on this project. It happens once every 12-36 months, and to what effect -- the time is off by a second?

The Parallax appears to be yet-another-u-blox-7 module. Overpriced at $50, when you can pick up a VK-172 for $10-20 -- or if you have to have a serial connection, an RY725AI (or generic equivalent) for $20 shipped.

@cyoung
Copy link
Owner

cyoung commented Apr 1, 2016

I know, I know. It's just code smell to me.

@skypuppy
Copy link

skypuppy commented Apr 1, 2016

I get the same sensitivity as the Sirf III USB (the gold standard for
years) with the MTK3339 without external antenna.
I use an external (amplified) puck antenna to give me more flexibility
in the vehicle/plane. Plus, it w-a-y more sensitive. Does the VK even
have the option (jack) for an external antenna?
I do not know why those garbage sentences get spewed, but I'm guessing
the MTK3339 processor is sticking it's tongue out at software that sends
it incorrect commands.
if we do the CRC check after each NMEA line (as we're supposed to do),
the garbage doesn't matter.
Did you notice it can do 10 hz, and a few others, as well as 1 hz?
The battery backup for setting SOC real clock time-of-day on boot, to
me, is priceless.
My research showed it receives more than one GNSS system at a time; for
proof, have you ever seen it have 22 sats in view at the same time?
American GPS, at least according to the last design specs I remember,
never has more than 12 sats visible at any one time, not counting WAAS
birds.
You might like "cutecom" better than minicom.

Skypuppy

On 03/31/2016 11:03 PM, AvSquirrel wrote:

I've been playing with the Adafruit for about a week now (thanks again
@skypuppy https://github.com/skypuppy !) and I'm getting a better
handle on its idiosyncrasies.

Likes:

  • Most configuration options can be set by writing NMEA sentences.
    That means I can easily test with minicom, and the Stratux code is
    a bit more readable. Both are very handy for development, even if
    they're not useful to the end user.
  • Battery-backed RTC is accurate and correct /immediately/ after a
    cold reset (even if current Stratux codebase doesn't support it)
  • External antenna option could be useful for some users

Dislikes:

  • No additional reporting capability beyond the standard NMEA
    sentences.
  • $40 pricetag is awfully steep for a receiver that only supports a
    single GNSS. It's old-ish tech, with a capability set on par with
    a u-blox 6 chipset. A product like this
    http://www.sainsmart.com/neu-ublox-neo-6m-gps-modul-aircraft-flight-controller-for-arduino-mwc-imu-apm2.html
    is basically the same feature set, except at less than half the price.
  • It handles MTK NMEA commands nicely. It rejects non-conforming
    NMEA sentences nicely. Why, then must it spout a line of garbage
    if I send it properly formed / checksummed NMEA sentences that it
    doesn't understand? Example: I send |$PUBX,00*33|, which would
    tell a u-blox receiver to give me a PUBX,00 position message. The
    MTK chipset returns "|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|" with
    no CR/LF at the end, so the next message also gets messed up. This
    can be problematic during the detection routine. Cmon, Mediatek.
    You're a GPS, not a Finnish speed metal band.

Disappointments:
For as much as its proponents play up its "-165 dBm" sensitivity, the
Adafruit Ultimate GPS is weaker than my RY835AI in bench testing, and
possibly weaker than my VK-172. The antenna is tiny, and it seems to
take longer (4-5 minutes) than my u-blox receivers to achieve position
lock from a cold start. To put some numbers on it, here's a
side-by-side comparison (literally -- they're sitting a foot apart on
the same windowsill) with the RY835AI. On average, the Adafruit saw
signal levels about 4 dB-Hz lower than the u-blox M8N implementation
on the RY835AI.

image
https://cloud.githubusercontent.com/assets/14127245/14197338/c4150406-f792-11e5-918b-42be18ca51c5.png


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#315 (comment)

@cyoung
Copy link
Owner

cyoung commented Apr 2, 2016

Is this an MTK3339 or compatible? http://amzn.com/B00N32HKIW

@skypuppy
Copy link

skypuppy commented Apr 2, 2016

It has the same specs as the 3339, but found this while searching the
web for your answer (which I did not find):

http://www.ebay.com/itm/USB-GPS-Receiver-GPS-Mouse-Antenna-for-Laptop-PC-Navigation-MTK3339-Chipset-/281984492508

Since it is an MTK3339 and USB and only $14, thought I'd pass it along.
However, the Amazon version does has some kind of battery (to maintain
the real-time clock and data?) but the other does not. Neither has a
jack for external antenna. No soldering required. :)

On 04/02/2016 01:06 PM, cyoung wrote:

Is this an MTK3339 or compatible? http://amzn.com/B00N32HKIW


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#315 (comment)

@aerojoe
Copy link

aerojoe commented Apr 5, 2016

@AvSquirrel @skypuppy
Just some comments on the Adafruit versus RY835 signal strength characterizations. The data in the table above is the "reported" signal/noise ratio of RF front end of each device. In general, any signal strength less than 32 db-Hz means that it's a very weak signal. In fact, I'm not sure the algorithms at those low signal levels are accurate or reliable. Brand A to Brand B comparisons with those estimates are not trustworthy. The only real way to verify claims of receiver sensitivity is to conduct calibrated tests. For our purposes here, the real world use is probably sufficient. So if the RY835 and Adafruit work well in our aircraft without problems, they may be equivalent from the signal capability point of view. Since I've not used the RY835, I can't comment on its performance in the aircraft.

@aerojoe
Copy link

aerojoe commented Apr 7, 2016

@AvSquirrel @skypuppy
I left my Stratux off for about a week after resolving all the issues above regarding ttyAMA0 connected to the Adafruit at 9600 baud using .8r2. When I repowered everything, the serial port data was again garbled and the web UI showed disconnected. I tried a number of things to get it working again to no avail. For grins, I reinserted a data card from .5b5 and sure enough the stratux processes the NMEA messages correctly. This release certainly predates the Sirf and Adafruit GPS support, but it tells me that all the configuration logic to support multiple GPS's needs improvement.

@skypuppy
Copy link

skypuppy commented Apr 7, 2016

Please verify and/or set your baud rate to 9600 explicitly upon each
invocation during testing. AIUI, stratux code likes to change it to
38.4 (AvSquirrle?).

Then, check your NMEA sentences.

On 04/07/2016 05:07 PM, aerojoe wrote:

@AvSquirrel https://github.com/AvSquirrel @skypuppy
https://github.com/skypuppy
I left my Stratux off for about a week after resolving all the issues
above regarding ttyAMA0 connected to the Adafruit at 9600 baud using
.8r2. When I repowered everything, the serial port data was again
garbled and the web UI showed disconnected. I tried a number of things
to get it working again to no avail. For grins, I reinserted a data
card from .5b5 and sure enough the stratux processes the NMEA messages
correctly. This release certainly predates the Sirf and Adafruit GPS,
but it tells me that all the configuration logic to support multiple
GPS's needs improvement.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#315 (comment)

@aerojoe
Copy link

aerojoe commented Apr 8, 2016

@skypuppy
You are correct sir! I rebuilt Stratux from scratch. Now I've reset it to 38.4 kbaud and it's working with .8r2.

My next step is to move this to Pi3
thanks

@ytwytw
Copy link

ytwytw commented Apr 19, 2016

@skypuppy @AvSquirrel I got a Adafruit Ultimate GPS Pi HAT

how can i get start to test this?

Thanks,

@skypuppy
Copy link

Adafruit says it is currently incompatible with he RPi3, but someone says they have made it work (with unspecified changed.) So you might only want to use it on a -2.
Be sure to go through Adafruit's "learning" tutorials as they have come through again and given some excellent tips about it. The Adafruit pages have some great ways to test it outside stratux. Just remember to use "service stratux stop" before trying their suggestions on a stratux image.

Now, for use in a Stratux, the mainstream production image does not currently support this GPS. AvSquirrel has some branches that do but I'm not sure how they gel with all the other changes made to the stratux software. AvSquirrel will have to answer that one. His branch worked GREAT on 0.8r1 but a lot has changed since then.

@ytwytw
Copy link

ytwytw commented Apr 19, 2016

@skypuppy I have figured out the reason why not working on Pi 3 is the UART changes

I have disabled the bluetooth and remapping the UART port to get it work for my NTP Server

so GPS itself works great as on Pi 2

I did a git clone on his repo https://github.com/AvSquirrel/stratux.git
and git checkout gpsattitude

Maybe I gonna try 0.8r1 commit and hope the best

@skypuppy
Copy link

Btw, Adafruit has come through again! On their "learning" pages, they now discuss how to implement gpsd, the GPS daemon that gives programmers a single library that hooks to most of the major GPS equipment, including ublox and MTK's. You have a choice of several methods. They even give some example code, as does the gpsd docs. There are some requirements to stop a service that Debian sets up in default, but it looks really easy. This could be the golden mousetrap we've been looking for.

@skypuppy
Copy link

Great work, ytwytw, and thanks for letting us know!

@ytwytw
Copy link

ytwytw commented Apr 19, 2016

@skypuppy Thanks!

My GPSd works fine

I would like to see how to feed it to Stratux now

@skypuppy
Copy link

skypuppy commented Apr 19, 2016

Using gpsd is not supported currently in stratux software. I've been playing with it but nothing worth posting as a branch. You might consider getting the data in "raw" mode as changes that large (using gpsd) must be done by stratux coders unless you're willing to make a branch...
Look at the examples on the Adafruit pages and on the gpsd doc pages.

Where I start screwing up so badly I don't take the time/effort to fix it is at the gps code in the stratux source where it feeds the data into the message builder that forwards to the EFB.

@ytwytw
Copy link

ytwytw commented Apr 19, 2016

I know GPSd will not work for stratux, but its a good test to check the GPS HAT is working

yeah i'm still trying to digging more how @AvSquirrel made it work

@skypuppy
Copy link

skypuppy commented Apr 19, 2016

If you find out, please let me know! :) Hahahaaha

Golang is pretty much a sthow-stopper for me. (and several others.)

@ytwytw
Copy link

ytwytw commented Apr 20, 2016

After couple tweaking

I can confirm @AvSquirrel 's gpsattitude branch does work perfectly with Adafruit GPS HAT

Unfortunately, I dont know how to setup Hotspot wifi on the pi yet so cant test outside my home (I built from source with clean Debian image)

capture233

2016-04-19 20 41 12

@ghost
Copy link
Author

ghost commented Apr 20, 2016

@peepsnet @aerojoe @ytwytw -

If you're interested using the MTK3339 on stock Stratux (v0.8r2, or any of the commits in @cyoung 's master branch), I wrote an interactive shell script that will configure the receiver to use 38.4 kbps, 5 Hz position refresh, with WAAS enabled, and to output all of the needed NMEA sentences:

https://github.com/AvSquirrel/stratux/blob/mtk-setup-script/test/mtk_config.sh

Run this script before starting gen_gdl90. If you have a backup battery installed in your Adafruit boards / hats, these settings should persist across power cycles.

The autodetection routine in my gpsattitude branch is still a little rough around the edges, and not ready to pull into the main branch. (Among other things, I need to get my hands on a BU-353 to verify that I won't mess it up.)

@ghost
Copy link
Author

ghost commented Apr 20, 2016

Also note that if you're trying to run with the latest commits, there is an incompatibility with GPIO serial on the RPi 3 (#393) that will prevent any serial device from connecting.

@skypuppy
Copy link

You da man, @AvSquirrel!
Also, Adafruit and other websites has some instructions on how to make the hat work on the -3. ytwytw has verified it works but you lose bluetooth. Thank goodness stratux doesn't need bluetooth.

@ghost
Copy link
Author

ghost commented Apr 20, 2016

Also, Adafruit and other websites has some instructions on how to make the hat work on the -3

That involves the following line to /boot/config.txt to move Bluetooth off of the hardware UART:

dtoverlay=pi3-miniuart-bt

You still need to comment out the references to ttyS0 in ry835ai as shown in #393 / #394.

@aerojoe
Copy link

aerojoe commented Apr 20, 2016

@skypuppy @AvSquirrel
I've had the Adafruit Ultimate GPS working with Pi3 for the last week. It's been very stable using the stock 0.8r2 build. The backup battery preserves the 38.4k baud. It did require following the instructions on their website to configure TTYAMA0 correctly (as stated above too). I don't have the HAT, but other than the ability to secure the module to the Pi, is there any advantage to the HAT over just using the module itself and securing it manually?

@aerojoe
Copy link

aerojoe commented Apr 20, 2016

@AvSquirrel
thanks for the script to set up the Adafruit with the correct baud, WAAS and update rates. I was trying to do this from the console to no avail. I'll download the script and try it out on the weekend.

@skypuppy
Copy link

Great place to put other sensors, like the IMU.

@cyoung
Copy link
Owner

cyoung commented Aug 24, 2016

Unable to add this at this time. U-blox receivers are ubiquitous, cheap, and come in every conceivable form. From what I'm seeing here and looking elsewhere, the MTK3339 based receivers are less common, more expensive, and less sensitive.

@cyoung cyoung closed this as completed Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants