Problems receiving more than 1 Art-Net universe

Hi

i try to receive more than 1 art-net universe exactly i want to receive 3 universes.
but when i send more than 1 universe nothing happens.
please could anyone point me in to the right direction?

i am using this code

/*CE SCRIPT PERMET DE RECUPERER LE DMX DANS UNE TRAME ART-NET
 ET DE L'APPLIQUER AUX SORTIES ARDUINO
 PERMET DONC DE TRAVAILLER EN RJ45 OU EN WIFI
 
 CE SCRIPT DECODE LA TRAME, 
 IL EST PLUS SUR QUE ART-NET RECEIVER RAW.PDE, QUI NE DECODE PAS
 LES IDENTIFIANTS ET LES OPERATINGS CODES DU PROTOCOLE ART-NET
 
 Fonctionne avec logiciel Arduino 22*/

////////////(c)Christoph Guillermet
////////////http://www.le-chat-noir-numerique.fr
////////////karistouf@yahoo.fr

#include <SPI.h>         // needed for Arduino versions later than 0018
#include <Ethernet.h>
#include <Udp.h>         // UDP library from: bjoern@cs.stanford.edu 12/30/2008
#define short_get_high_byte(x) ((HIGH_BYTE & x) >> 8)
#define short_get_low_byte(x)  (LOW_BYTE & x)
#define bytes_to_short(h,l) ( ((h << 8) & 0xff00) | (l & 0x00FF) );


// ADRESSES MAC ET IP du shield ethernet
//l'adresse MAC de la carte réseau est collée dans un sticker au dos de la carte
//pour la traduire en décimale, utiliser: http://www.frankdevelopper.com/outils/convertisseur.php

byte mac[] = {  
  144, 162, 218, 00, 16, 96  };
byte ip[] = {   
  10,1,1,108 };
// the next two variables are set when a packet is received
byte remoteIp[4];        // holds received packet's originating IP
unsigned int remotePort; // holds received packet's originating port
//Paramètres art net
unsigned int localPort = 6454;      // port UDP générique art-net=6454
const int nombre_de_circuits=512;
const int taille_chaine_artnet=8+17+nombre_de_circuits+1;

// buffers
const int MAX_BUFFER_UDP=1024;
char packetBuffer[MAX_BUFFER_UDP]; //buffer de stockage de la trame entrante

//Variables d'identification Art-Net
char ArtNetHead[8]="Art-Net";
char OpHbyteReceive=0;
char OpLbyteReceive=0;
short is_artnet_version_1=0;
short is_artnet_version_2=0;
short seq_artnet=0;
short artnet_physical=0;
short incoming_universe=0;
boolean is_opcode_is_dmx=0;
boolean is_opcode_is_artpoll=0;
boolean match_artnet=1;
short Opcode=0;

//buffer storage of the poll reply
char pollReply[] = {
  'A', 'r', 't', '-', 'N', 'e', 't', 0x00,
  0x00, 0x21,
  10, 0, 0, 1,
  0x36, 0x19,
  0, 0,
  0, 1,  // subnet address
  0x4, 0x31,  // oem
  0,
  0xd2,
  0x70, 0x7a,  // esta
  'L', 'E', 'D', '-', 'T', 'u', 'b', 'e', 's',
  0,0, 0, 0, 0, 0, 0, 0, 0,  // short name
  'L', 'E', 'D', '-', 'T', 'u', 'b', 'e', 's', ' ', 
  'A', 'R','T', '-', 'N', 'e', 't', ' ', '2', ' ', 'D', 'M','1', '3', '4',
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // long name
  '#', '0', '0', '0', '1', ' ', '[', '0', ']', ' ', 'O', 'L', 'A',
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0,  // node report
  0, 3,  // num ports
  0xc0, 0xc0, 0xc0, 0xc0,
  8, 8, 8, 8,
  0x80, 0, 0, 0,
  0x20, 0x20, 0x20, 0x20,  // swin
  0x23, 0x20, 0x20, 0x20,  // swout
  0, 0, 0, 0, 0, 0, 0,  // video, macro, remote, spare, style
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED,  // mac address  
  0xa, 0x0, 0x0, 0x1,
  0,
  8,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0  // filler
};
int tubescount = 25;

//Pins for tubes data
int datapin  = 5; // DI
int clockpin = 6; // CI
int latchpin = 7; // LI

void setup() {  
  // démarrage ethernet et serveur UDP
  Ethernet.begin(mac,ip);
  Udp.begin(localPort);
  Serial.begin(115200);

  pinMode(datapin, OUTPUT);
  pinMode(latchpin, OUTPUT);
  pinMode(clockpin, OUTPUT);
  digitalWrite(latchpin, LOW);
}

void loop() {
  int update = 0;
  int packetSize = Udp.available();
  if(packetSize==taille_chaine_artnet)//si un packet de la taille de la chaine art-net
  {
    Udp.readPacket(packetBuffer,MAX_BUFFER_UDP, remoteIp, remotePort);  
    //lecture de l'identifiant
    match_artnet=1;//valeur de stockage
    for (int i=0;i<7;i++)
    {
      if(char(packetBuffer[i])!=ArtNetHead[i])
      {
        match_artnet=0;
        break;
      }//si ce n'est pas correspondant au header Art-Net, on arrête
    } 
    if (match_artnet==1)
    { 
      for (int i=0;i<MAX_BUFFER_UDP;i++)
      {
        Serial.print(byte(packetBuffer[i]));
      }
      Serial.println("");
      //version protocole utilisé
      //is_artnet_version_1=packetBuffer[10]; 
      //is_artnet_version_2=packetBuffer[11];
      //séquence d'envoi des données
      //seq_artnet=packetBuffer[12];//0
      //émission de la trame venant du port physique dmx N°
      //artnet_physical=packetBuffer[13];//

      //operator code qui permet de savoir de quel type de message Art-Net il s'agit
      Opcode=bytes_to_short(packetBuffer[9],packetBuffer[8]);
      is_opcode_is_artpoll=0;
      is_opcode_is_dmx=0;
      if(Opcode==0x5000)//il s'agit d'une trame dmx
      {
        Serial.println("DMX-DATA");
        is_opcode_is_dmx=1;
        is_opcode_is_artpoll=0;
      }   
      else if(Opcode==0x2000)//il s'agit d'un artpoll: un node art-net demande sur le réseau qui est présent
      {
        Serial.println("POLL");
        is_opcode_is_artpoll=1;
        is_opcode_is_dmx=0;
        //ici il faudrait renvoyer une trame artpoll reply au node qui a lancé le art-poll
      } 

      if (is_opcode_is_artpoll==1) 
      {
        Serial.println("GOT POLL");
        //Udp.sendPacket(pollReply, remoteIp, remotePort); 
      }

      if (is_opcode_is_dmx==1)
      {
        //Extraction de l'univers DMX, si vous avez besoin de filtre
        incoming_universe= bytes_to_short(packetBuffer[15],packetBuffer[14]);//extraction de l'univers

        //report dans un buffer dmx de la trame reçue
        if (incoming_universe==0) {
          for(int i=0;i<510;i++)
          {
            if (byte(packetBuffer[i+17]) > 128) {
              sendbit(1);
            } 
            else {
              sendbit(0);
            }
          }
          Serial.println("OK (0)");  
        }
        if (incoming_universe==1) {
          for(int i=0;i<510;i++)
          {
            if (byte(packetBuffer[i+17]) > 128) {
              sendbit(1);
            } 
            else {
              sendbit(0);
            }
          }
          Serial.println("OK (1)");  
        }
        if (incoming_universe==2) {
          for(int i=0;i<180;i++)
          {
            if (byte(packetBuffer[i+17]) > 128) {
              sendbit(1);
            } 
            else {
              sendbit(0);
            }
          }
          sendlatch();
          Serial.println("OK (2)");
        }

      }

    }

  } 

}

// Functions for sending to tubes

void sendbit(int dataout) {
  if (dataout == 1) {
    digitalWrite(datapin, HIGH);   
    digitalWrite(clockpin,HIGH);                  
    digitalWrite(datapin, LOW); 
    digitalWrite(clockpin,LOW);   
  } 
  else {
    digitalWrite(datapin, LOW);   
    digitalWrite(clockpin,HIGH);                   
    digitalWrite(clockpin,LOW);
  }
}

void sendlatch() {
  digitalWrite(latchpin,HIGH);
  digitalWrite(latchpin,LOW); 
}
const int MAX_BUFFER_UDP=1024;
char packetBuffer[MAX_BUFFER_UDP]; //buffer de stockage de la trame entrante

There went half your memory, unless you are using a Mega.

char pollReply[] = {
  'A', 'r', 't', '-', 'N', 'e', 't', 0x00,
  0x00, 0x21,
  10, 0, 0, 1,
  0x36, 0x19,
  0, 0,
  0, 1,  // subnet address
  0x4, 0x31,  // oem
  0,
  0xd2,
  0x70, 0x7a,  // esta
  'L', 'E', 'D', '-', 'T', 'u', 'b', 'e', 's',
  0,0, 0, 0, 0, 0, 0, 0, 0,  // short name
  'L', 'E', 'D', '-', 'T', 'u', 'b', 'e', 's', ' ', 
  'A', 'R','T', '-', 'N', 'e', 't', ' ', '2', ' ', 'D', 'M','1', '3', '4',
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // long name
  '#', '0', '0', '0', '1', ' ', '[', '0', ']', ' ', 'O', 'L', 'A',
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0,  // node report
  0, 3,  // num ports
  0xc0, 0xc0, 0xc0, 0xc0,
  8, 8, 8, 8,
  0x80, 0, 0, 0,
  0x20, 0x20, 0x20, 0x20,  // swin
  0x23, 0x20, 0x20, 0x20,  // swout
  0, 0, 0, 0, 0, 0, 0,  // video, macro, remote, spare, style
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED,  // mac address  
  0xa, 0x0, 0x0, 0x1,
  0,
  8,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0  // filler
};

There's a whole lot more bytes gone.

i try to receive more than 1 art-net universe exactly i want to receive 3 universes.

It would be useful to know what a art-net universe is, and what you are trying to do with three of them.

It would be interesting to know how much free memory you have.

It would be interesting to know what Arduino you have.

Finally, it would be interesting to know what actually happens when that code runs.

but when i send more than 1 universe nothing happens.

Send from where?

hi

i am using an arduino uno.

one art-net universe holds the data from one dmx universe (this a protocoll for light technic communication).

i would like to controll 25 led tubes (each tube is 1m long and has 16 RGB Pixels). they are controlled in an spi like way ( data,clock, latch).

using 2 unisverses all is fine. with 2 universeses i can controll 20 of these tubes.

perhabs i have to split it on multiple arduinos to get the performance i would like to see.

the code just stops working when i activate the third universe.
i am sending art-net data from a chamsys MQ100Pro (this is a professional lighting desk)

There are a number of techniques to determine how much available memory you have. Search the forum for FreeMemory and/or MemoryFree. See how much memory you have available. My guess is "not enough".

Is the UDP packet being sent really 1024 bytes?

I am working on a similar setup, but I have a little bit of a different problem, getting the poll reply to work. I am using a program called DMX-Workshop to send the data, and when I reply to the packet, the computer reads different data every time I send the packet, almost as if the Arduino and the computer are talking at different speeds. Do any of you have any insight as to what may be happening? If I try to use this on a lighting desk(ETC ION) will I get better results?