Serial ISR conflict when trying to use SD library.

For a project I am dependend on a certain libary. This library needs to do something with the serial interrupt which is fine. I tested the library and what it is supposed to do, functions perfectly fine.

But than I included <SD.h> and than this happened.

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_18'

I know precisely what is going on. These lines of my custom library

#elif defined(SERIAL_PORT_0)
ISR(USART_RX_vect) {
	XpressNetClass::handle_interrupt();	 //weiterreichen an die Funktion
}

conflicts with the Sd.h library.

Now I looked into the SD library to see if I can 'remove' any conflicting code but I cannot find. I looked into several header files which were mention in the sd library.. but it is such a web I got lost.

So I have 2 questions: Is this actually fixable? I need to use both SD and SPI library and the my custom library needs to do it's thing as well.

And if it is fixable. How can?

Kind regards,

Bas

What model Arduino are you using? On the ATmega328P (UNO, Nano) the USART Rx Complete vector is 19, not 18.

Thank you for you'h help. I try to compile for a atmega328P. I tried to compile with arduino IDE and arduino CLI for UNO and Nano boards.

The compiler still gives me this error.

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_18'

If I comment the include to SD.h out, the project compiles just fine.

Also I don't think you are correct because

/* USART Rx Complete */
#define USART_RX_vect            _VECTOR(18)
#define USART_RX_vect_num        18

This line occurs in 14 different files within the arduino folder.
Bas

Similar problem to this: DMXSerial has conflict with SD library · Issue #14 · mathertel/DMXSerial · GitHub

The SD library uses Serial for debugging, which is causing the Serial library code to be included in the sketch, conflicting with your usage of the serial interrupt.
Had a quick look at the SD library files, there is also some use of Serial in the library functions, so you will need to go through all the .cpp files in the src and utility directories and comment out the references to Serial.

I found that link before. But at the time it did not get me anywhere however. It did make look harder now. I searched the entire SD folder for Serial.

Inside SdFile.cpp there were several Serial.print's 'hidden' inside a function. After commenting these out I can compile again. Now the SD module also compiles I have a slight 113% ram usage issue. :roll_eyes: But that I can solve.

Thanks for the assist.

Bas

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.