Go Down

Topic: GPS Signal Read Via Hardware Serial Arduino Mega 2650 Losing Data (Read 132 times) previous topic - next topic

supernovagt

Good Afternoon,

I was wondering if someone might be able to help me out with the problem that I am facing.

I am using ulbox Neo-6M GPS module connected to hardware serial on Mega2650 together with Adafruit ILI9341 TFT display connected via SPI.

In the code I am relying on TinyGPS++ library to read incoming NMEA data from the GPS unit and display some of the information on the TFT display. GPS module is running at 5Hz and serial baud rate is set at 38400.

The problem that I have is that the writing to the display in the main loop takes too long and causes serial buffer to fill up, which starts to drop bits and causes CRC checks failure.

The first remedy was to increase serial buffer which did not help. As time goes by it fills up and data starts to drop.

Is there are any way to mitigate this?

The problem with writing and updating text on TFT is that to clear it you have to fill over the text with the  rectangles with the same colour is the background, or am I doing it wrong?

Any help would be greatly appreciated.

/dev

Quote
The problem that I have is that the writing to the display in the main loop takes too long and causes serial buffer to fill up, which starts to drop bits and causes CS checks failure.

...Is there are any way to mitigate this?
Yes.  You are experiencing one of the problems that caused me to write NeoGPS and the companion serial libraries NeoSWSerial, NeoICSerial and NeoHWSerial.  This problem is described in the Troubleshooting section, which gives several techniques for avoiding the data loss.  NeoGPS is also faster and smaller, and can be configured to parse only the messages and fields that you really use.

Be sure to follow the Installation Instructions, because the NeoGPS files are copied to your sketch directory, not the libraries folder.  However, the Neo**Serial libraries are copied to the Libraries directory, like most Arduino libraries.

Cheers,
/dev

supernovagt

Thanks for your suggestion, I am trying to get it working on Arduino Zero using hardware serial which I declare:

Code: [Select]
Uart Serial2 (&sercom1, 11, 10, SERCOM_RX_PAD_0, UART_TX_PAD_2);
void SERCOM1_Handler()
{
  Serial2.IrqHandler();
}

 and later in the setup
Code: [Select]
pinPeripheral(10, PIO_SERCOM);
pinPeripheral(11, PIO_SERCOM);


Thus I skip using GPSPort.h but I have to use NeoHWSerial library, however I get an error in NMEAGPS.h during compile time saying that cli() and sei() are not declared in the scope.

I had a look around and it needs include of #include <util/atomic.h>. Is this something that is missing in the NMEAGPS.h file or am I missing something here?

Also, if I include NeoHWSerial, I am getting an error missing USBAPI.h, which I am also not sure where to find.

Once again, thanks for your help!

/dev

Quote
I get an error in NMEAGPS.h during compile time saying that cli() and sei() are not declared in the scope... it needs include of #include <util/atomic.h>. Is this something that is missing in the NMEAGPS.h file
Yes!  I have an outstanding issue on github for this, on a Due, so thanks for looking that up.  I'll add that conditionally, although I need to do some more research.  Just add it to your files for now.

Quote
I have to use NeoHWSerial library
Are you sure?  NeoHWSerial just adds the attachInterrupt capability to the standard HardwareSerial.  You're already servicing the IRQ...  Could you just call gps.handle( c ) from SERCOM1_Handler?  Does it also handle characters transmitted to the GPS?  Could you derive a class from Uart and override IrqHandler?

Sorry, I'm not much help on the Due/Zero.  :smiley-confuse:

Cheers,
/dev

supernovagt

I will try and do more digging about and see what I can come up with.

You are a great help, thank you. I am very new to embedded hardware so I am learning by doing and your help and your time is most definitely appreciated.

Thank you

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy