problems with as_GPS

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
uraich
Posts: 56
Joined: Tue Mar 26, 2019 12:24 pm

problems with as_GPS

Post by uraich » Mon Aug 03, 2020 2:48 pm

Hi Pete,
Now that the display is working I am on your as_GPS driver. I am using a Neo Max6 GPS module on an ESP32.
I cloned your micropython-asyncio repository and I tried astests.py in v3/as_drivers/as_GPS.
It gives me a
ImportError: attempted relative import with no known parent package
error. astests in micropython-async/gps (v2 I guess) works fine.
I replaced the relative imports by absolute ones (as in the working astests.py) and tried to run the program on the ESP32. There I get a
OverflowError: overflow converting long int to machine word
error.
as_GPSError.png
as_GPSError.png (45.41 KiB) Viewed 3343 times
Any ideas how to correct?
Thanks Uli

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: problems with as_GPS

Post by pythoncoder » Mon Aug 03, 2020 5:35 pm

Two points.

Firstly, if installed and run as per the docs, the relative imports work.

Secondly, the astests.py script is documented as a "special test program". I evidently didn't clarify this properly. It simulates the GPS data enabling a quick check on the code, and it's intended to be run under Linux. It runs under CPython 3.8+ or MicroPython. The problem arises because it assumes the Unix epoch. MicroPython on bare metal uses a different epoch. From the v3 directory the following runs here:

Code: Select all

micropython -m as_drivers.as_GPS.astests
I'll update the docs to clarify this. You are the first to try to run this on bare metal - I certainly never did.

I suggest you start with one of the scripts in section 3, adapted for whichever UART you are using.
Peter Hinch
Index to my micropython libraries.

uraich
Posts: 56
Joined: Tue Mar 26, 2019 12:24 pm

Re: problems with as_GPS

Post by uraich » Tue Aug 04, 2020 4:42 pm

Things work quite ok now but...
There is one things that intrigues me: I get plenty of crc errors.
crcErrors.png
crcErrors.png (32.69 KiB) Viewed 3309 times
First I thought that this must be a hardware problem but when I run just the uart, printing out all the messages I see and putting them to the parser when reading back the file, then my crc error count is zero!
Otherwise everything looks fine
Uli

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: problems with as_GPS

Post by pythoncoder » Wed Aug 05, 2020 7:18 am

That is odd. I don't think I've ever seen a CRC error from my Adafruit GPS. I can only think they come from the GPS module.
Peter Hinch
Index to my micropython libraries.

uraich
Posts: 56
Joined: Tue Mar 26, 2019 12:24 pm

Re: problems with as_GPS

Post by uraich » Wed Aug 05, 2020 12:18 pm

Yes, that was my first reaction as well. Particularly because I use one of those super-cheap Chinese modules.
However I also tried this: I simply read the NMEA sentences coming from the GPS receiver and print them out. Then I cut and paste ~ 400 of these messages into a file on the PC and I run them through a program similar to your astest.py program (this time on run it in CPython!) with the only difference that I don't use predefined hardcoded sentences but the sentences from the file.
gpsParsing.png
gpsParsing.png (67.1 KiB) Viewed 3275 times
As you can see, not a single crc error!
I observe that the GPS module sends batches of ~ 10 sentences at a frequency of 1 Hz. Does your GPS module do the same thing?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: problems with as_GPS

Post by pythoncoder » Thu Aug 06, 2020 9:22 am

See my notes on timing. I guess if your GPS is sending a lot of satellite data at 9600 baud there could be occasional overrun errors.
Peter Hinch
Index to my micropython libraries.

Post Reply