arduino-pcimanager icon indicating copy to clipboard operation
arduino-pcimanager copied to clipboard

Conflict between Pcimanager & SoftwareSerial

Open timwilson235 opened this issue 8 years ago • 5 comments

I want to use SoftTimer and SoftwareSerial together. To use SoftTimer, I have to also include PciManager.h. But if I include both PciManager.h and SoftwareSerial.h, I get a stream of ld errors (sample below). I am using latest releases of SoftTimer & PciManager (3.1.0 and 2.1.0 respectively), and the SoftwareSerial that's built-in to Arduino IDE 1.6.5.

Compile output follows:

Arduino: 1.6.5 (Mac OS X), Board: "Arduino/Genuino Uno"

PciManager/PciManager.cpp.o: In function __vector_3': /Users/twilson/Documents/Arduino/libraries/PciManager/src/PciManager.cpp:144: multiple definition of__vector_3' SoftwareSerial/SoftwareSerial.cpp.o:/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:227: first defined here PciManager/PciManager.cpp.o: In function PciManagerClass::remove(PciListener*)': /Users/twilson/Documents/Arduino/libraries/PciManager/src/PciManager.cpp:63: multiple definition of__vector_4' SoftwareSerial/SoftwareSerial.cpp.o:/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:392: first defined here PciManager/PciManager.cpp.o: In function PciManagerClass::remove(PciListener*)': /Users/twilson/Documents/Arduino/libraries/PciManager/src/PciManager.cpp:63: multiple definition of__vector_5' SoftwareSerial/SoftwareSerial.cpp.o:/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:392: first defined here collect2: error: ld returned 1 exit status Error compiling.

timwilson235 avatar Nov 12 '15 20:11 timwilson235

I confirm the problem. The SoftwareSerial occupies PinChangeInterrupt PCI vectors, so does the PciManager. This causes the conflict. As matter stand PciManager cannot be used in combination with SoftwareSerial. I need to consult with the authors of SoftwareSerial whether we can find a solution for that.

(It seems that I finally need to make it possible to use SoftTimer without PciManager, but thats an issue for the SoftTimer project.)

prampec avatar Nov 13 '15 10:11 prampec

Same problem here!

acacha avatar Dec 31 '15 10:12 acacha

Unfortunately I couldn't found a way to consult with the authors of SoftwareSerial. If one can help me in that I might do any further steps.

If you are about to use SoftTimer with SoftwareSerial, you can remove Debouncer and Rotary source files that needs PciManager, to remove dependency. If I find an origin of SoftwareSerial (which I could not), I might want to provide a patch, so that SoftwareSerial use PciManager instead direct PCI access.

Another solution is for you to use an older version of SoftwareSerial.

prampec avatar Dec 31 '15 23:12 prampec

I just ran into this same issue. Is there a fix (in the wild) yet...or has anyone come up with a work around - besides removing debouncer and rotary.

dedayoa avatar Jan 31 '18 20:01 dedayoa

I have forked (and keep managed) a version of the SoftTimer, that contains only the core functionality and no classes requires PCI. https://github.com/prampec/arduino-softtimer-nopci

(It still can be possible to migrate the SoftwareSerial source code to use PciManager so that other event handlers could also benefit from the PCI interrupts.)

prampec avatar Jan 31 '18 21:01 prampec