Error w/ Adafruit GPS Library & GSM Library together
Moderators: adafruit_support_bill, adafruit

Error w/ Adafruit GPS Library & GSM Library together

by udanis on Sat Apr 06, 2013 7:19 pm

Hey guys I am working on a project using an Arduino Uno, the new Arduino GSM shield and the adafruit gps logger shield. I can get both sets of example programs and libraries to work on their own. The issue arises when I start trying to use the libraries together. I was hoping someone was could provide me with some insight into the issue. The adafruit gps shield uses the SoftwareSerial.h in addition to the Adafruit_GPS.h. I get the error regardless of the sketch when all three libraries are called. I just used an empty shell of a program to ensure it wasn't my code. I have been fighting with this project the for the past few days and figured it was time to ask for help.

Code: http://pastebin.com/pEGY1jAf

Error: http://pastebin.com/GX4KA1ei


Here is a picture of the boards: http://i.imgur.com/EKLSMCD.jpg


Thanks for the Help!
udanis
 
Posts: 6
Joined: Sat Apr 06, 2013 7:17 pm

Re: Error w/ Adafruit GPS Library & GSM Library together

by adafruit_support_rick on Sat Apr 06, 2013 7:50 pm

What those error messages are telling me is that the GSM library has a software serial module that was probably derived from the regular software serial library. They are both defining the same global symbols __vector5, __vector4, etc.

What that means is that both libraries are declaring interrupt service routines on the same interrupt vectors.

I think you're going to have to edit both libraries so that they aren't trying to use the same interrupt vectors.
User avatar
adafruit_support_rick
 
Posts: 11689
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Error w/ Adafruit GPS Library & GSM Library together

by udanis on Sat Apr 06, 2013 7:58 pm

Is the solution as simple as renaming the interrupt vectors or am I going to run into issues with both libraries trying to use software based serial?

Edit: Thanks for the quick reply btw :D
udanis
 
Posts: 6
Joined: Sat Apr 06, 2013 7:17 pm

Re: Error w/ Adafruit GPS Library & GSM Library together

by adafruit_support_rick on Sat Apr 06, 2013 8:30 pm

Did some more research on the Arduino GSM. You must be using Arduino 1.0.4, because that's where the GSM library first appears.

The library page says this:
The GSM library is included with Arduino IDE 1.0.4 and later.
With the Arduino GSM Shield, this library enables an Arduino board to do most of the operations you can do with a GSM phone: place and receive voice calls, send and receive SMS, and connect to the internet over a GPRS network.
The GSM shield has a modem that transfers data from a serial port to the GSM network. The modem executes operations via a series of AT commands. The library abstracts low level communications between the modem and SIM card. It relies on the Software Serial library for communication between the moden and Arduino.


Try taking the #include <SoftwareSerial.h> out of your sketch, and maybe put the #include <GSM.h> before the #include "Adafruit_GPS.h". See if that helps.

If not, then check your libraries folder for an old version of SoftwareSerial and delete it.
User avatar
adafruit_support_rick
 
Posts: 11689
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Error w/ Adafruit GPS Library & GSM Library together

by udanis on Sat Apr 06, 2013 8:43 pm

Okay, so if I take out "#include <SoftwareSerial.h>" and re-order the include statements I get a different error:

http://pastebin.com/uBMri8CD (the **** is where my computer account name was)

I took a look in my libraries folder and the only instance I have of software serial is from 3/11/13 so I am assuming that is newer.
udanis
 
Posts: 6
Joined: Sat Apr 06, 2013 7:17 pm

Re: Error w/ Adafruit GPS Library & GSM Library together

by adafruit_support_rick on Sat Apr 06, 2013 9:46 pm

Looks like you're on a Mac? You shouldn't have SoftwareSerial in your sketch folder/libraries folder at all. It's already hidden inside the Arduino application package.
User avatar
adafruit_support_rick
 
Posts: 11689
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Error w/ Adafruit GPS Library & GSM Library together

by udanis on Sat Apr 06, 2013 10:18 pm

Yes sir, you are correct.
SoftwareSerial is in the arduino app package. I can see it/access it if I control click the arduino.app then "show package contents" arduino.app/contents/resources/java/libraries

The only libraries (besides the standard ones included in the arduino ide) I have added to the ide are the gps and sd ones from adafruit. Both of those are located in documents/arduino/libraries
udanis
 
Posts: 6
Joined: Sat Apr 06, 2013 7:17 pm

Re: Error w/ Adafruit GPS Library & GSM Library together

by adafruit_support_rick on Sat Apr 06, 2013 10:40 pm

I am going to declare this an Arduino bug. It has nothing to do with the Adafruit_GPS library, since I can get the same sorts of errors without including any Adafruit libraries.

In Arduino 1.0.4, I opened the TestGPRS example sketch (which does compile successfully), and tried including SoftwareSerial.

Code: Select all | TOGGLE FULL SIZE
// libraries
#include <GSM.h>
#include <SoftwareSerial.h>

I got the __vector errors you were getting:
Code: Select all | TOGGLE FULL SIZE
SoftwareSerial/SoftwareSerial.cpp.o: In function `__vector_3':
/Applications/Arduino_104.app/Contents/Resources/Java/libraries/SoftwareSerial/SoftwareSerial.cpp:305: multiple definition of `__vector_3'
GSM/GSM3SoftSerial.cpp.o:/Applications/Arduino_104.app/Contents/Resources/Java/libraries/GSM/GSM3SoftSerial.cpp:511: first defined here
SoftwareSerial/SoftwareSerial.cpp.o: In function `__vector_4':
/Applications/Arduino_104.app/Contents/Resources/Java/libraries/SoftwareSerial/SoftwareSerial.cpp:312: multiple definition of `__vector_4'
GSM/GSM3SoftSerial.cpp.o:/Applications/Arduino_104.app/Contents/Resources/Java/libraries/GSM/GSM3SoftSerial.cpp:518: first defined here
SoftwareSerial/SoftwareSerial.cpp.o: In function `__vector_5':
/Applications/Arduino_104.app/Contents/Resources/Java/libraries/SoftwareSerial/SoftwareSerial.cpp:319: multiple definition of `__vector_5'
GSM/GSM3SoftSerial.cpp.o:/Applications/Arduino_104.app/Contents/Resources/Java/libraries/GSM/GSM3SoftSerial.cpp:525: first defined here


I also opened the SoftwareSerialExample sketch. That compiles for a Uno, but when I switch the target to Mega, it blows up:
Code: Select all | TOGGLE FULL SIZE
Applications/Arduino_104.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o: In function `__vector_default':
(.vectors+0xdc): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_55' defined in .text.__vector_55 section in core.a(HardwareSerial.cpp.o)

The header comment states:
Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69


But it sets up SoftwareSerial for 10 and 11, so it should be OK:
Code: Select all | TOGGLE FULL SIZE
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX


I've notified ladyada and the rest of the support team here. Meanwhile, I suggest you see where you can get with the Arduino support forums.
User avatar
adafruit_support_rick
 
Posts: 11689
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Error w/ Adafruit GPS Library & GSM Library together

by udanis on Sat Apr 06, 2013 11:23 pm

Okay thank you for your help.
udanis
 
Posts: 6
Joined: Sat Apr 06, 2013 7:17 pm

Re: Error w/ Adafruit GPS Library & GSM Library together

by adafruit_support_rick on Sat Apr 06, 2013 11:31 pm

Good luck. Keep us posted here in this thread!
User avatar
adafruit_support_rick
 
Posts: 11689
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Error w/ Adafruit GPS Library & GSM Library together

by udanis on Wed Apr 10, 2013 8:04 am

I figured I would just let you know how I am still using the gsm and gps shield together.

I am now running two arduino's one with each shield then I am having them send the data to each other using the wire.h library. Hopefully the gsm/softwareserial bug gets solved soon because it would be nice to use both shields on one arduino.
udanis
 
Posts: 6
Joined: Sat Apr 06, 2013 7:17 pm

Re: Error w/ Adafruit GPS Library & GSM Library together

by Dietger on Sun Jul 28, 2013 10:28 am

i'm running against the same problem. Any news on a sollution for the issue?

thank in advance for the help.
Dietger
 
Posts: 5
Joined: Sun Jul 28, 2013 10:24 am

Re: Error w/ Adafruit GPS Library & GSM Library together

by adafruit_support_rick on Sun Jul 28, 2013 2:52 pm

No idea. You might want to check with the Arduino forums
User avatar
adafruit_support_rick
 
Posts: 11689
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Error w/ Adafruit GPS Library & GSM Library together

by Dietger on Mon Jul 29, 2013 2:41 pm

The first test show the problem is solved.

I used some info from following thread on the Arduino forums : http://forum.arduino.cc/index.php?PHPSESSID=vcr4iiqou4apthibis48bmr0t3&topic=173459.0

Someone suggest AltSoftSerial instead of SoftwareSerial and change the GSM library. At first AltSoftSerial doesn't do the trick. Also I had a look at the gsm library but I'm not that good in programming so changing that one was a bit over my head.

Using AltSoftSerial only in the sketch still brings up the errors while compiling. In your Adafruit_gps library SoftwareSerial is also used/loaded and that one gives also problems. Replaced SoftwareSerial with AltSoftSerial, recompiled sketch and seems ok. First test give good results.
Dietger
 
Posts: 5
Joined: Sun Jul 28, 2013 10:24 am

Re: Error w/ Adafruit GPS Library & GSM Library together

by adafruit_support_rick on Mon Jul 29, 2013 3:11 pm

Interesting. I can believe that you would have trouble modifying the GSM library.
But I'm not sure how AltSoftSerial gets around the problem. Perhaps it isn't interrupt-driven?
User avatar
adafruit_support_rick
 
Posts: 11689
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY