DMX Library and HardwareSerial - Multiple definitions of __vector_36


hi there.

i'm working on home domotics system using arduino mega. i'd use following library: http://www.deskontrol.net/blog/arduino-four-universes-dmx-512-library/. since mega has 4 uart hardwares, i'd use 2nd 1 drive dmx. in header of dmx library set use uart1.

now, when compiling error:
core.a(hardwareserial.cpp.o): in function `__vector_36':
c:\program files (x86)\arduino\hardware\arduino\cores\arduino/hardwareserial.cpp:147: multiple definition of `__vector_36'
dmx\lib_dmx.cpp.o:c:\program files (x86)\arduino\libraries\dmx/lib_dmx.cpp:206: first defined here


these lines correspond following pieces of code:

lib_dmx.cpp
code: [select]
#if defined(use_uart1)
   isr (sig_usart1_recv)
   {
     arduinodmx1.process_isr_rx(1);
   }
 #endif


hardwareserial.cpp (line isr in it)
code: [select]
#if defined(usart1_rx_vect)
 void serialevent1() __attribute__((weak));
 void serialevent1() {}
 #define serialevent1_implemented
 isr(usart1_rx_vect)
 {
   if (bit_is_clear(ucsr1a, upe1)) {
     unsigned char c = udr1;
     store_char(c, &rx_buffer1);
   } else {
     unsigned char c = udr1;
   };
 }
#endif


my full program code is:

code: [select]

/*-----------------------------------------------------------------------------
include files
------------------------------------------------------------------------------*/
#include <spi.h>
#include <ethernet.h>
#include <ethernetudp.h>
#include <lib_dmx.h>

#define dmx512  (0)

byte mac[] = { 0xdd, 0xad, 0xbe, 0xef, 0xfe, 0xed };
ipaddress ip(10,0,0,2); // todo: assign ip address dhcp
unsigned int multicastport = 8888;
ipaddress multicastip(239,0,0,57);

char packetbuffer[udp_tx_packet_max_size];

ethernetudp udp;

int sensorvalue = 0;
int ledstate = 0;
int dmxpin = 0;

void setup() {
 
 // dmx
 arduinodmx1.set_control_pin(dmxpin);
 arduinodmx1.set_rx_channels(1);
 arduinodmx1.set_tx_channels(5);
 arduinodmx1.init_tx(dmx512);
 
 ethernet.begin(mac,ip);
 udp.beginmulti( multicastip, multicastport );
 serial.begin(9600);
 
}

void loop() {
 int packetsize = udp.parsepacket();
 if(packetsize){
   serial.print("received packet of size ");
   serial.println(packetsize);
   serial.print("from ");
   ipaddress remote = udp.remoteip();
   for (int =0; < 4; i++){
     serial.print(remote[i], dec);
     if (i < 3){
       serial.print(".");
     }
   }
   serial.print(", port ");
   serial.println(udp.remoteport());

   udp.read(packetbuffer,udp_tx_packet_max_size);
   serial.println("contents:");
   serial.println(packetbuffer[0]);
   
   arduinodmx1.txbuffer[0] = (int)packetbuffer;
 }
}


i'm using adjusted ethernet library supports udp multicast (found here: https://github.com/aallan/arduino ).

i'm not familiar interrupts on arduino, have no idea how fix this. want use first uart debugging, second dmx, , other ones should communication other arduino's.

that library works on arduino if hardwareserial.cpp not used, i.e. no serial, serial1, serial2, serial3 used.

to make work, modify hardwareserial.cpp posted excerpt looks this:

code: [select]
#if defined(usart10_rx_vect)
  void serialevent1() __attribute__((weak));
  void serialevent1() {}
  #define serialevent1_implemented
  isr(usart1_rx_vect)
  {
    if (bit_is_clear(ucsr1a, upe1)) {
      unsigned char c = udr1;
      store_char(c, &rx_buffer1);
    } else {
      unsigned char c = udr1;
    };
  }
#endif


note changed ifdef line @ start, way serial1 object not usable have serial reception interrupt free library use.


Arduino Forum > Using Arduino > Programming Questions > DMX Library and HardwareSerial - Multiple definitions of __vector_36


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support