Arduino GSM shield not compatible with Leonardo board.

The Arduino GSM Shield is not very compatible with the Leonardo, and the library uses interrupts different for the Leonardo.
There is a guide for it: http://arduino.cc/en/Guide/GSMShieldLeonardoMega
But that still uses pin 3 for TX. However, pin 3 is also SCL for the I2C bus.

It would better if the GSM shield could be used and still keep the Serial1 and I2C available.
The solution is simple, use RX to pin 8 (as described in the Guide) and TX to pin 9.
The RXINT should not be used, since pin 8 supports PCINT change interrupt for the normal SoftwareSerial library.

In the library GSM3SoftSerial, the interrupt for the Leonardo is not very well implemented. It seems to be a work in progress. As it is implemented at the moment, I would call it a bug.
I suggest to remove the interrupt number for the Leonardo, and make it possible to use a pin as described for the SoftwareSerial library.
The library and the guide should be changed.

In this post I suggested to make RXINT value 100, to disable it.
http://forum.arduino.cc/index.php?topic=269816.msg1913883#msg1913883
I don't know if RXPIN value 8 will use the PCINT change interrupt without further change.

http://arduino.cc/en/Main/arduinoBoardLeonardo

I know this is an old thread but I hope it is the current one.

I am trying to connect the Mega 2560 to the GSM shield and have followed this post and your guide but am now at a loss.

The only 'proof of life' I got from the GSM shield is when I used HW Serial using the AltSoftSerial library. This required connections to pins 0 and 1 on shield to be connected to the mega on 48 and 46 with 44 and 45 to be taken up for interrupts. I followed the instructions in AltSoftSerial Library, for an extra serial port. My shield looks like the image in the link below.

http://www.elecrow.com/wiki/index.php?title=File:GPRS_Shield_interface.png

But as I set the jumpers to sw serial mode and used jp 7 and 8, or even using hw serial mode on jp 0,1 on the shield, i could not communicate to 9,8 on the Mega using the GSM3 library. I did set to 9,8,100 the tx,rx,rxint in GSM3IO.h.

I would appreciate your help.

thanks
chris

I would appreciate your help.

First, you need to clarify some stuff.

The only 'proof of life' I got from the GSM shield is when I used HW Serial using the AltSoftSerial library.

Hardware serial is NOT done using AltSoftSerial. What are you actually doing?

i could not communicate to 9,8 on the Mega using the GSM3 library.

Pins 8 and 9 on the Mega do not support pin change interrupts. That is what is needed for the GSM3 library to work.

Apologies for the delay in replying but I am missing my email alerts on updates - Will try to fix.

The HWserial (i believe) is being set through my jumper settings on the GSM shield and I'm using jumpers 0,1 on the shield. The AltSoftSerial is being used to have 2 serial sessions- one between the modem and the mega and the other replicating comms to the serial between the mega and pc.

...

I thought I had to use 8,9. I also tried 14,15 but am at a loss what going on.

thanks
Chris

Take a look at the page on my signature. It covers connecting a shield like this to the Mega2560.

The AltSoftSerial is being used to have 2 serial sessions- one between the modem and the mega and the other replicating comms to the serial between the mega and pc.

You have 4 hardware serial ports. You have not adequately explained why you need a second software serial port (besides the one that the moronic GSM library insists on using).

Thanks to all for your contribution.

The following are my test results:

  • I learnt I got clones and not the real deal :frowning: and probably hence the issues (pics included)
  • For instance as you can see from the pictures, the GSM Shield has the jumpers reversed for D7/D8 (the pic are for setting them in this manner. I tested with a meter). Hence the confusion when I though I was using HWSerial. My SwSerial setting is to set the jumper to be close to the antenna.
  • I could not make the serial1 connection work to the gsm shield as per dannable's link on pins 18/19 but managed to make it work on pins 50/51 with SoftwareSerial.h and AltSoftSerial.h on pins 46/48

The pictures show he pins connected to 50/51 when it was tested successfully with SoftwareSerial.

The tests were confirmed to be successful as commands were returned by the modem to the serial monitor.

The question now remains as to how to make use of the GSM3 library. I figured that the settings are in GSM3IO.h and changed it as follows (extract). Note that I want to use 50/51 as these are confirmed to work with SoftwareSerial but I could not connect to 14-19.

#if defined(AVR_ATmega328P)
#ifdef TTOPEN_V1
#define TXPIN 3
#define RXPIN 4
#define RXINT 3
#else
#define TXPIN 3
#define RXPIN 2
#define RXINT 3
#endif
#elif defined(AVR_ATmega2560) || defined(AVR_ATmega1280)
#define TXPIN 51 //WAS 3
#define RXPIN 50 //was 10
#define RXINT 50 //was 4
#elif defined(AVR_ATmega32U4)
#define TXPIN 3
#define RXPIN 8
#define RXINT 3
#endif

I also tried disabling RXINT to 100 as per Peter_n's post but this did not work.

Any clues welcome. Hope it is clearer now.

thanks
Chris

apologies but the pics could not be loaded due to size restrictions.

I am reloading the Arduino IDE for the library changes to be taken into consideration. I'm unsure as to whether this is the way to do it.

It worked! RXINT can be disabled and I should wait longer for initialisation!

Great forum! Keep it up!

If there are inconsistencies in online documentation, I think the best option is to notice it to Github guys via opening an issue