Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

Modifying Libraries
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Modifying Libraries

by glim on Mon Jul 07, 2008 2:23 pm

Hello,

I recently downloaded the AFSoftSerial library for the Arduino, for which I'm very grateful -- my previous software serial functions were giving me headaches. However, I do need to modify one part of it, and I don't have much recent experience with C/C++, so I'm not sure how to do that. Do I just need to modify the .cpp file, or do I need to somehow re-compile or re-assemble it so that I have a new .o file?

Thanks!
glim
 
Posts: 4
Joined: Mon Jul 07, 2008 2:19 pm

Another question...

by glim on Mon Jul 07, 2008 3:56 pm

Ok, I got this worked out. Sorry about posting it before I had fully researched the topic.

This is part of a broader question that I still have, though. I'm trying to use AFSoftwareSerial to retrieve data from a GPS unit at 4800 baud through an Arduino Diecimila. I know that the GPS unit is outputting correctly, because I loaded another software serial program onto the board and tried it. However, the data AFSoftwareSerial is retrieving is just nonsense junk. I have a feeling that it's a timing problem, especially since every now and then a correct character shows up...but I already tried varying the bit delay everywhere from 188 to 270 (with 208 being the calculated correct value, and 232 being the library's default).

Any thoughts on this?
glim
 
Posts: 4
Joined: Mon Jul 07, 2008 2:19 pm

by franklin97355 on Mon Jul 07, 2008 5:32 pm


franklin97355
 
Posts: 21490
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Another question...

by adafruit on Mon Jul 07, 2008 7:04 pm

glim wrote:Ok, I got this worked out. Sorry about posting it before I had fully researched the topic.

This is part of a broader question that I still have, though. I'm trying to use AFSoftwareSerial to retrieve data from a GPS unit at 4800 baud through an Arduino Diecimila. I know that the GPS unit is outputting correctly, because I loaded another software serial program onto the board and tried it. However, the data AFSoftwareSerial is retrieving is just nonsense junk. I have a feeling that it's a timing problem, especially since every now and then a correct character shows up...but I already tried varying the bit delay everywhere from 188 to 270 (with 208 being the calculated correct value, and 232 being the library's default).

Any thoughts on this?


which gps module

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by glim on Tue Jul 08, 2008 1:22 am

franklin97355 wrote:Have you read this yet?http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1176181152


Yeah...but I'm actually using AFSoftSerial as an alternative to the Arduino SoftwareSerial library. Since I'm using this on a real-time system (an autopilot), it was unacceptable that SoftwareSerial would hang if it got no input -- this means that if the GPS device failed, the autopilot would just hang, or else be continually reset by the watchdog.

And ladyada, it's an EM-408 GPS module from SparkFun. Like I said before, it was working at the same baud rate with SoftwareSerial, but AFSoftSerial seemed to have some trouble with the data. The complexity of AFSoftSerial makes me feel that it's more robust than SoftwareSerial, but also makes me less willing and less able to just start poking around with constructive results... :P
glim
 
Posts: 4
Joined: Mon Jul 07, 2008 2:19 pm

by adafruit on Tue Jul 08, 2008 7:23 pm

never used the '408
i know for sure the '406 works just fine at 4800 baud
make sure you have the rx pin pulled high if you're not using it, check the timing with a scope, etc.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by glim on Tue Jul 08, 2008 10:19 pm

I'll definitely fiddle around with the timing some more...but I did a little bit more digging through the junk and found something interesting. The GPS strings I'm supposed to be getting are in the format:

$GPVTG,...[numbers and stuff]

...and, with line breaks at strategic points, the junk forms this kind of pattern:

D;jK¤;¹Ìcs¦3
glim
 
Posts: 4
Joined: Mon Jul 07, 2008 2:19 pm

Please be positive and constructive with your questions and comments.