Using own interrupt handlers: Collision of ISRs

I’m quite new to Arduino but i’ve worked with Atmel AVRs and AVR-Studio before, so I don’t know if this is perhaps a standard issue, but I didn’t find anything in the Arduino docs nor the faq. So please don’t blame me for asking, just point me into the right direction then.

I want to use a library for receiving DMX lighting cotrol protocol, wich is based on rs-485. The code (a .c and a corresponding .h file) of the library is a modified version of hendrik hoelscher’s DMX512 reception library “lib_dmx_in” (i adjusted all register/pin names and constants.)

I can compile and test the code with AVR-Studio on a ATmega168 within the simulator. But when i try to use it with arduino (#include <lib_dmx_in.h>) there is a collision of the interrupt handler in the lib “ISR (USART_RX_vect){…}” and the one in arduinos wiring_serial.c “SIGNAL(SIG_USART_RECV)” which seems to be linked to the project, although i don’t use wiring.
The error message looks like this:

C:\DOKUME~1\newton\LOKALE~1\Temp\build15603.tmp\core.a(wiring_serial.c.o): In function `__vector_18’:

D:\Programme\arduino-0011\hardware\cores\arduino\wiring_serial.c:112: multiple definition of `__vector_18’

hardware\libraries\DMX_IN\lib_dmx_in.o:D:\Programme\arduino-0011/hardware\libraries\DMX_IN\lib_dmx_in.c:113: first defined here

d:\programme\arduino-0011\hardware\tools\avr\bin…\lib\gcc\avr\4.1.2…\avr\bin\ld.exe: Warning: size of symbol `__vector_18’ changed from 192 in hardware\libraries\DMX_IN\lib_dmx_in.o to 122 in C:\DOKUME~1\newton\LOKALE~1\Temp\build15603.tmp\core.a(wiring_serial.c.o)

Any hints how to overcome this problem would be great.
Thanks alot!
greetings from Berlin


Hello again,

meanwhile i updated to the new arduino-0012 and wrote a small
class DmxReceiver (in a .h /.cpp ) around the original lib which
basically wraps the c-function calls into class-methods.

So far so good, but the main problem is untouched: the interrupt
routine of the library ISR (USART_RX_vect), needed for receiving the
incoming DMX signal via the USART, is already defined in the file

C:\DOKUME~1\newton\LOKALE~1\Temp\build24575.tmp\core.a(wiring_serial.c.o): In function `__vector_18':

D:\Programme\arduino-0012\hardware\cores\arduino/wiring_serial.c:112: multiple definition of `__vector_18'

hardware\libraries\DMX_IN\lib_dmx_in.o:D:\Programme\arduino-0012/hardware\libraries\DMX_IN/lib_dmx_in.c:120: first defined here

I don't understand why the wiring-stuff needs to be linked to my sketch.
The release note from arduino-0008 says:
"Patched to reduce binary sketch sizes by building the Arduino core
as a library (.a) file - now only the needed parts of the core are
linked into a sketch."

Any suggestions?
Thanks a lot


I am surprised that the arduino serial code is being linked if you are not calling any of the arduino serial functions.

Perhaps try this test: take one of the simple example sketches that doesn’t use the serial port (blink.pde for example) and add your isr routine. If that compiles and links ok then something in your sketch is bringing in the arduino routines and you may be able to find it through trial and error additions of code to the example sketch until you get the error.

I hope that helps

That's a good idea, thanks mem.

I'll try that later...

I am working on the same project, in a similar plan of attack as you, Zeb.

My serial receive operations are giving me junk at times, and I think it is because of other interrupts disrupting the serial read at critical moments. So I thought I could put my time sensitive code inside the USART_RX_vect ISR, which would not be interrupted by other interrupts while running.

When compiling, I get a similar error message:

C:\Users\Max\AppData\Local\Temp\build3450.tmp\wiring_serial.c.o: In function `__vector_18':

C:\Program Files (x86)\arduino-0013-win\arduino-0013\hardware\cores\arduino/wiring_serial.c:112: multiple definition of `__vector_18'

o:C:\Users\Max\AppData\Local\Temp\build3450.tmp/Temporary_6403_5722.cpp:42: first defined here
Couldn't determine program size: C:\Program Files (x86)\arduino-0013-win\arduino-0013\hardware/tools/avr/bin/avr-size: 'C:\Users\Max\AppData\Local\Temp\build3450.tmp\receiver_rev3.hex': No such file

I tried moving the ISR code over to blink.pde as suggested by mem, but got the same error message. Has anyone had any luck setting up a custom serial receive ISR?


You may want to look at this DMX library:

Thanks for the info, but I'm trying to receive DMX, not send it.

How do I override the default USART_RX_vect ISR?

I found a sort of work-around, which I've posted here:

sorry about the double post.