1

I'm working on an arduino project that uses the GSM Shield and the eHealthSensor from Cooking Hacks. However I ran into an issue in which the interrupt vectors from the header/cpp files used are being defined multiple time.

While I know where the definitions are, I am unsure as to how to circumvent this issue either by Arduino programming or modifying the files since I'm not too experienced in this field. Below are the code for the conflicting files.

Below are the vectors that are in conflict.

PinChangeInt.h

    #ifndef NO_PORTA_PINCHANGES
    ISR(PCINT0_vect) {
        #ifdef PINMODE
        PCintPort::s_PORT='A';
        #endif
        PCintPort::curr = portA.portInputReg;
        portA.PCint();
    }
    #define PORTBVECT PCINT1_vect
    #define PORTCVECT PCINT2_vect
    #define PORTDVECT PCINT3_vect
    #else
    #define PORTBVECT PCINT0_vect
    #define PORTCVECT PCINT1_vect
    #define PORTDVECT PCINT2_vect
    #endif

    #ifndef NO_PORTB_PINCHANGES
    ISR(PORTBVECT) {
        #ifdef PINMODE
        PCintPort::s_PORT='B';
        #endif
        PCintPort::curr = portB.portInputReg;
        portB.PCint();
    }
    #endif

    #ifndef NO_PORTC_PINCHANGES
    ISR(PORTCVECT) {
        #ifdef PINMODE
        PCintPort::s_PORT='C';
        #endif
        PCintPort::curr = portC.portInputReg;
        portC.PCint();
    }
    #endif

    #ifndef NO_PORTD_PINCHANGES
    ISR(PORTDVECT){ 
        #ifdef PINMODE
        PCintPort::s_PORT='D';
        #endif
        PCintPort::curr = portD.portInputReg;
        portD.PCint();
    }
    #endif

    #ifdef __USE_PORT_JK
    #ifndef NO_PORTJ_PINCHANGES
    ISR(PCINT1_vect) {
        #ifdef PINMODE
        PCintPort::s_PORT='J';
        #endif
        PCintPort::curr = portJ.portInputReg;
        portJ.PCint();
    }
    #endif

    #ifndef NO_PORTK_PINCHANGES
    ISR(PCINT2_vect){ 
        #ifdef PINMODE
        PCintPort::s_PORT='K';
        #endif
        PCintPort::curr = portK.portInputReg;
        portK.PCint();
    }
    #endif

    #endif // __USE_PORT_JK

GSM3SoftSerial.cpp

// This is here to avoid problems with Arduino compiler
void GSM3SoftSerialMgr::manageMsg(byte from, byte to){};

//#define PCINT1_vect _VECTOR(2)
//#undef PCINT1_vect

#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

Any advice on how to fix this will be greatly appreciated.

If it helps, I am using an Arduino Mega 2560.

  • You need to rewrite the GSM library to use the pcint library instead of handling the interrupts itself. – Ignacio Vazquez-Abrams Jan 2 '15 at 10:07
2

It's linking problem. More .o files included in linking declares identical global symbol eg. ISR(PCINT1_vect). Ideally write own makefile and compile via standard make. As hack you can loook in PinChangeInt.h conditional parts and make global definitions not to avoid *ISR()*s, e.g. #define __USE_PORT_JK

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.