DIY Drones

This is sort of the second half to an earlier discussion I started about problems with software serial that I was having with the Arduino. I didn't like the fact that the SoftwareSerial library would hang if serial input was abruptly cut off, so somebody recommended ladyada's AFSoftSerial library (originally posted about here). I hate to post about a similar topic twice, but after much experimentation, I realized that I probably don't have the technical knowledge yet to be able to understand the problem...

What's happening is basically that the AFSoftSerial library is reading junk, just random characters, from the GPS module. However, I know that the GPS module is outputting correctly, because using the SoftwareSerial library, I get the output I want. Also, I know that it is indeed trying to read from the GPS module and not just floating because when I disconnect the wire from the GPS module to the Arduino, the junk stops. Also, I know that hyperterminal and the connection from my computer to the Arduino is formatted correctly because the Arduino sends a "hello" message when it boots, which is coming through perfectly.

I did notice a pattern in the junk though. The GPS strings that the module is outputting look like:

$GPVTG,...[other stuff]

...and here's some sample output from AFSoftSerial, with line breaks placed at strategic points:

D;jK¤;¹Ìcs¦3\£9˝c3¹ÌdcÆ:Ë`sf3››S¦³Sü
D;jK¤;¹Æ2esF3\£9˝c39ÌacÆ
D;jK¤;9
D;jK¤;9Æ

This made me think at first that it was just a matter of shifting ascii codes, but shifted so that "D" becomes "$", the rest of the message is still unintelligible. It also sort of looks like a timing issue, but I tried changing the bit delay everywhere from 188 to 270 microseconds (the GPS module is outputting at 4800 baud) with no avail.

I would welcome any thoughts on this -- I know it's sort of a complex issue, but I really don't know where to go from here...

Share

Reply to This

Replies to This Discussion

Did you ever get this sorted? I am having exactly the same problem and not really getting much help from Ladyada

Thanks in advance, Garth

Reply to This

Hi,

Perhaps a dumb comment but looking at the output...
Do you have speed and bits set correctly? The above looks to me exactly like 7bit characters read when expecting 8bit or viceversa...
You have 8bit and 7bit serial comms and they do look exactly like above when one end is set wrong.
Either that or it is shifting bits or something like this

Reply to This

$GPV = 0x24 0x47 0x50 0x56 (hex)
= 00100100 01000111 01010000 01010110 (binary)

D;jK¤ = 0x44 0x3B 0x6A 0xA4 (hex)
= 01000100 00111011 01101010 10100100 (binary)

First byte looks similar in lower 5 bits, then another bit gets to wrong position. So changing delays could help.

Reply to This

Check the data bytes. I had this before, it was set to 7bits rather than 8.

Reply to This

AFSoftSerial is somewhat outdated also, might help to try upgrading to
http://sundial.org/arduino/?page_id=61
which builds on the Lady's library.

If you are still completely stuck you may want to give it a shot after all else fails

Reply to This

Clarence is right, go NewSoftSerial. I had quite unattended good results with it, even in multiple soft serial instances (one with 34800 and the other with as much as 57600 bauds, once I tweaked the parameter constants in an appropriate h. file to optimize garbage generation as described in this post entry. Link to the Arduiana NewSoftSerial page is here. By the way, I found the TinyGPS and PString libraries quite useful too.
Some of my experiments are mentioned here.

Reply to This

RSS

© 2009   Created by Chris Anderson

Badges  |  Report an Issue  |  Privacy  |  Terms of Service

Sign in to chat!