Error w/ Adafruit GPS Library & GSM Library together

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
udanis
 
Posts: 8
Joined: Sat Apr 06, 2013 8:17 pm

Error w/ Adafruit GPS Library & GSM Library together

Post by udanis »

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://BANNED.com/pEGY1jAf

Error: http://BANNED.com/GX4KA1ei


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


Thanks for the Help!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

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

Post by adafruit_support_rick »

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
udanis
 
Posts: 8
Joined: Sat Apr 06, 2013 8:17 pm

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

Post by udanis »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

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

Post by adafruit_support_rick »

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
udanis
 
Posts: 8
Joined: Sat Apr 06, 2013 8:17 pm

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

Post by udanis »

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

http://BANNED.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.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

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

Post by adafruit_support_rick »

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
udanis
 
Posts: 8
Joined: Sat Apr 06, 2013 8:17 pm

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

Post by udanis »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

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

Post by adafruit_support_rick »

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

// libraries
#include <GSM.h>
#include <SoftwareSerial.h>
I got the __vector errors you were getting:

Code: Select all

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

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

#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
udanis
 
Posts: 8
Joined: Sat Apr 06, 2013 8:17 pm

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

Post by udanis »

Okay thank you for your help.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

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

Post by adafruit_support_rick »

Good luck. Keep us posted here in this thread!

User avatar
udanis
 
Posts: 8
Joined: Sat Apr 06, 2013 8:17 pm

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

Post by udanis »

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.

Dietger
 
Posts: 5
Joined: Sun Jul 28, 2013 11:24 am

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

Post by Dietger »

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

thank in advance for the help.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

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

Post by adafruit_support_rick »

No idea. You might want to check with the Arduino forums

Dietger
 
Posts: 5
Joined: Sun Jul 28, 2013 11:24 am

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

Post by Dietger »

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?PHPSE ... c=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.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

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

Post by adafruit_support_rick »

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?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”