Go Down

Topic: Why does the GSM library attach interrupts on ALL Arduino PINs? (Read 3109 times) previous topic - next topic

butyouyes

I noticed that the GSM library (the GSM3SoftSerial) attaches interrupts on all ports/pins of the Arduino: why on ALL of them? I can understand PINs 2&3 that are used for RX/TX, but why on all of them?

In particular I would need to attach interrupts to other PINs to do other things (such as waking up the Microprocessor at pin change), but it conflicts with the GSM interrupts. Here the code snippet from the GSM3SoftSerial that is culprit I believe:

Code: [Select]

#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
  GSM3SoftSerial::handle_interrupt();
}
#endif

#if defined(PCINT1_vect)
ISR(PCINT1_vect)
{
  GSM3SoftSerial::handle_interrupt();
}
#endif

#if defined(PCINT2_vect)
ISR(PCINT2_vect)
{
  GSM3SoftSerial::handle_interrupt();
}
#endif

#if defined(PCINT3_vect)
ISR(PCINT3_vect)
{
  GSM3SoftSerial::handle_interrupt();
}
#endif


Do you think I can safely remove all ISRs except the one on PCINT2_vect (i.e. for port C, that contains PINs 2&3 on the Arduino Uno)?

Thanks

davidgoth

Its a topic derived from primary development. In future version, will be fixed

fliperbaker

Hi butyouyes,
by the momment we can use a workaround, Arduino GSM Shield only uses PCINT interrupts for digital pins 2 and 3, which are managed with PCINT2 interrupt (PCINT23..16, atmega328p datasheet).

What I did was to comment the rest of the interrupt routine assignenment in GSM library and comment PCINT2 vector routine assignement in SoftwareSerial library.

At the end, in GSM3SoftSerial.cpp

Code: [Select]
/*
#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
  GSM3SoftSerial::handle_interrupt();
}
#endif

#if defined(PCINT1_vect)
ISR(PCINT1_vect)
{
  GSM3SoftSerial::handle_interrupt();
}
#endif
*/
#if defined(PCINT2_vect)
ISR(PCINT2_vect)
{
  GSM3SoftSerial::handle_interrupt();
}
#endif

#if defined(PCINT3_vect)
ISR(PCINT3_vect)
{
  GSM3SoftSerial::handle_interrupt();
}
#endif


and in SoftwareSerial.cpp:

Code: [Select]

#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
  SoftwareSerial::handle_interrupt();
}
#endif

#if defined(PCINT1_vect)
ISR(PCINT1_vect)
{
  SoftwareSerial::handle_interrupt();
}
#endif
/* disable this interrupt to enable them at GSM libray (test)
#if defined(PCINT2_vect)
ISR(PCINT2_vect)
{
  SoftwareSerial::handle_interrupt();
}
#endif

#if defined(PCINT3_vect)
ISR(PCINT3_vect)
{
  SoftwareSerial::handle_interrupt();
}
#endif
*/


Then you can compile a sketch with both libraries and it works!,

leoguti

Best regards,

Currently I have arduino club in high school at the Salesian College of Duitama in Colombia.

We are working on a project that aims to integrate these weather sensors:

https://www.sparkfun.com/products/8942

With this code (which requires interrupts on pin 2 or 3)
http://home.comcast.net/ ~ saustin98/misc/WeatherStationADC.txt

In a connected arduino gsmshield

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

We want the report of the measurements will be sent to a server via the GSM shield, however because the gsm shield uses pins 2 and 3 do not know how to accomplish anemometer capture information (the sensor that requires interruptions)

Is it possible to capture information with interruptions in the same assembly arduino or this not possible?

Thanks in advance

Go Up