1

I have a Ublox-NEO6M gps module that I am trying to read using SoftwareSerial. The GPS sends a few NMEA sentences at 9600 baud each 5th second - totally a couple of hundred characters. My 3.3V atmega 328 on an arduino pro board seems not to be able to cope and is loosing characters. One set of NMEA sentences ends up looking like

$GPRMC,131953.00,A,5939.89405,N,01038.33769,E,0.399,,060316,,,A*79
$GPVTG,,T,,0,.K2$G335.50.6,745,0*
GA1,2,0,.1,2
G,5,12702,21214G,,1,,,84,81037$S,,26,55,09,17*
G41,12388,2*$L39,1.615,6

The first one is good, all the following are mangeled (they should always start with $G and never contain a $ within the string.

If I set the transmission speed to 4800 baud, the arduino reads it without problems. Connecting the GPS to the same Serial USB interface that I use for the pro, so it talks directly to the PC, everything works at 9600, so the problem must be at the arduino. Is is as expected that soft serial is not working at higher baudrates than 9600? are there any settings I could change?(I was looking for possible buffer values without finding anything) Or are there other soft-serial libraries that is faster than SoftwareSerial?

I may end up using the hardware serial interface if I need the speed, but as that makes development and debugging a bit harder, I would prefer to use some other serial interface.. (and now, it is not possible to use a mega, this is prototyping for a gpssystem that cannot be too large)

closed as unclear what you're asking by Nick Gammon Jan 1 '17 at 3:56

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Have you tested increasing the SoftwareSerial RX buffer? Default is 64 bytes. How large are the burst? Please post a snippet of your sketch. – Mikael Patel Mar 6 '16 at 15:36
  • Your code is absolutely critical to this question - most likely the problem is that you are not handling the received data very well, and that, rather than the software serial implementation itself, is causing the problem. – Chris Stratton Apr 6 '16 at 2:54
  • Voting to close as the code at issue has never been provided. – Chris Stratton Oct 3 '16 at 2:37
  • 1
    I am closing this question as the requested code has not been provided, and the question seems to be abandoned. There are various versions of SoftwareSerial, more details would help to answer. A newer version of the SoftwareSerial library might be all that is required. – Nick Gammon Jan 1 '17 at 3:56
0

This is a classic example of where you choose the wrong chip just because it's the most popular chip around here.

What you want is a dedicated hardware UART just for the GPS that isn't used for your debugging connection.

But, you say, you can't use a Mega because it's too big. And that's true as far as it goes. However, you have blinkered yourself into considering either a Nissan Micra or an 18-wheel juggernaut. You forgot the Ford Focus or the Renault Meganne.

There are other chips besides the (what is too under-specced for you) ATMega328 and the (what is too over-specced for you) ATMega2560. Chips that have other facilities.

Chips like the ATMega32U4 for example.

One hardware UART like the 328, which you can use for the GPS. One USB interface, which you can use for debugging.

And there are boards already with that chip on it - boards like the Arduino Leonardo, or the Arduino Micro.

  • The '328 software serial should probably be able to keep up with 9600 baud. The problem is more likely poor software design of the user's sketch, which would likely remain a problem even using a hardware UART. That said, the new '328PB with its second USART seems interesting. – Chris Stratton Apr 6 '16 at 2:53
  • @ChrisStratton Shame it's not available as a DIP for breadboarders to use (or to replace the chip on an Uno). – Majenko Apr 6 '16 at 11:46
  • How about a 32u4 based board? They've got USB along with a hardware uart. – Paul Dec 2 '16 at 7:17
0

Atmega328p at 16MHz can run Software Serial at up to 9600 baud reliably. But, you have a 3.3v board and the chip is not spec'd for 16MHz at that voltage (though I do it successfully...). Your board is probably built to run at 8MHz - half the speed - so I'm not surprised that Software Serial would only keep up at half of 9600 baud. If you try it on a 16MHz board or a homebrew, I expect it will work as you intended.

0

Instead of SoftwareSerial, consider using NeoSWSerial as it is much more efficient and reliable, something that is important for an 8MHz device. It will work at 9600, but it requires Timer2 on an 8MHz Pro. Using pins 8 & 9 with AltSoftSerial would be even better.

As other have suggested, it is very easy to have the wrong program structure for these "verbose" GPS devices. Most examples are poorly structured and fail as soon as you modify them.

The example programs in NeoGPS are structured in a way to avoid this data loss. It looks like characters are being lost, because there is an input buffer overflow. This is frequently caused by "Trying To Do Too Many Things" (see Troubleshooting section).

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