Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 27

Thread: OctoSK6812+Artnet+ 280ledsSK6812 x4: Only first 3 universes ok, next are lagging

  1. #1
    Junior Member
    Join Date
    Aug 2017
    Posts
    19

    OctoSK6812+Artnet+ 280ledsSK6812 x4: Only first 3 universes ok, next are lagging

    Hello Everybody.
    I really need RGBW strips for a show (I'm a light designer for theater).
    So I use Teensy 3.2 + OctoWS2811 Adaptor + WIZ820io Adaptor. (I've already use this with WS2811 and APA102 projects with no difficulties).
    I use Madmapper to drive 4 ledstrips of 280 leds on 4 outputs of OctoWS2811 Adaptor
    I tried OctoSK6812Test and everything's ok.
    But with Artnet, i've got a problem:
    384 first leds are OK (Universe 0,1 and 2) but leds of universe 3 (4th universe) are lagging (refresh every 20s) and leds of universes 4 to 8 are off....

    Here is my code:
    Code:
    // Receive multiple universes via Artnet and control a strip of ws2811 leds via OctoWS2811
    //
    // This example may be copied under the terms of the MIT license, see the LICENSE file for details
    //  https://github.com/natcl/Artnet
    // 
    // http://forum.pjrc.com/threads/24688-Artnet-to-OctoWS2811?p=55589&viewfull=1#post55589
    
    
    /*11  192.168.0.121   0x90, 0xA2, 0xDA, 0x00, 0x44, 0xCB
    12  192.168.0.122   0x90, 0xA2, 0xDA, 0x00, 0x44, 0xCC   
    */
    
    #include <Artnet.h>
    #include <Ethernet.h>
    #include <EthernetUdp.h>
    #include <SPI.h>
    #include <OctoSK6812.h>
    
    // OctoWS2811 settings
    const int ledsPerStrip = 280; // change for your setup
    const byte numStrips= 4; // change for your setup
    DMAMEM int displayMemory[ledsPerStrip*8];
    int drawingMemory[ledsPerStrip*8];
    
    OctoSK6812 leds(ledsPerStrip, displayMemory, drawingMemory, SK6812_GRBW);
    
    // Artnet settings
    Artnet artnet;
    const int startUniverse = 0; // CHANGE FOR YOUR SETUP most software this is 1, some software send out artnet first universe as zero.
    const int numberOfChannels = ledsPerStrip * numStrips * 4; // Total number of channels you want to receive (1 led = 4 channels)
    byte channelBuffer[numberOfChannels]; // Combined universes into a single array
    
    // Check if we got all universes
    const int maxUniverses = numberOfChannels / 512 + ((numberOfChannels % 512) ? 1 : 0);
    bool universesReceived[maxUniverses];
    bool sendFrame = 1;
    
    // Change ip and mac address for your setup
    byte ip[] = {192, 168, 0, 121};
    byte mac[] = {0x90, 0xA2, 0xDA, 0x00, 0x44, 0xCB};
    
    void setup()
    {
     // Serial.begin(115200);
      artnet.begin(mac, ip);
      leds.begin();
      initTest();
    
      // this will be called for each packet received
      artnet.setArtDmxCallback(onDmxFrame);
    }
    
    void loop()
    {
      // we call the read function inside the loop
      artnet.read();
    }
    
    void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
    {
      sendFrame = 1;
    
      // Store which universe has got in 
      //NOT WORKING WITH MADMAPPER because  MadMapper won't pollute the network with network packets for universes 
      //that have not changed (except one packet each 4 seconds as defined in official ArtNet spec).
      /*if (universe < maxUniverses)
        universesReceived[universe] = 1;
    
      for (int i = 0 ; i < maxUniverses ; i++)
      {
        if (universesReceived[i] == 0)
        {
          //Serial.println("Broke");
          sendFrame = 0;
          break;
        }
      }
    */
      // read universe and put into the right part of the display buffer
      for (int i = 0 ; i < length ; i++)
      {
        int bufferIndex = i + ((universe - startUniverse) * length);
        if (bufferIndex < numberOfChannels) // to verify
          channelBuffer[bufferIndex] = byte(data[i]);
      }      
    
      // send to leds
      for (int i = 0; i < ledsPerStrip * numStrips; i++)
      {
        leds.setPixel(i, channelBuffer[(i) * 4], channelBuffer[(i * 4) + 1], channelBuffer[(i * 4) + 2], channelBuffer[(i * 4) + 3]);
      }      
      
      if (sendFrame)
      {
        leds.show();
        // Reset universeReceived to 0
        memset(universesReceived, 0, maxUniverses);
      }
    }
    
    void initTest()
    {
      for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
        leds.setPixel(i, 127, 0, 0, 0);
      leds.show();
      delay(500);
      for (int i = 0 ; i < ledsPerStrip * numStrips  ; i++)
        leds.setPixel(i, 0, 127, 0, 0);
      leds.show();
      delay(500);
      for (int i = 0 ; i < ledsPerStrip * numStrips  ; i++)
        leds.setPixel(i, 0, 0, 127,0);
      leds.show();
      delay(500);
      for (int i = 0 ; i < ledsPerStrip * numStrips  ; i++)
        leds.setPixel(i, 0, 0, 0, 127);
      leds.show();
      delay(500);
      for (int i = 0 ; i < ledsPerStrip * numStrips  ; i++)
        leds.setPixel(i, 0, 0, 0, 0);
      leds.show();
    }


    Thank you.

  2. #2
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    899
    Hi there. Have you increased the ethernet buffer size? Forum user Crees has commented on this in the post here: https://forum.pjrc.com/threads/45760...625#post150625

  3. #3
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by mortonkopf View Post
    Hi there. Have you increased the ethernet buffer size? Forum user Crees has commented on this in the post here: https://forum.pjrc.com/threads/45760...625#post150625
    I don't know how to do it. Do i have to modify the Artnet library?

  4. #4
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    I've modified the artnet.h file from #define MAX_BUFFER_ARTNET 530 to #define MAX_BUFFER_ARTNET 1060 restart IDE but nothing better.
    The transmition is good in universe 0 to 2, is bad for Universe 4 to 8.
    Here is a video: https://youtu.be/l9asNc0yRdQ
    Last edited by Lagelat; 08-27-2017 at 09:47 AM.

  5. #5
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,092
    Quote Originally Posted by mortonkopf View Post
    Hi there. Have you increased the ethernet buffer size? Forum user Crees has commented on this in the post here: https://forum.pjrc.com/threads/45760...625#post150625
    also see https://forum.pjrc.com/threads/28975...l=1#post109591

  6. #6
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Increasing the artnet buffer size will not help and might cause problems.
    Are you saying you tested this before with ws2811 and it worked well ?

  7. #7
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by nlecaude View Post
    Increasing the artnet buffer size will not help and might cause problems.
    Are you saying you tested this before with ws2811 and it worked well ?
    Ok for Artnet size buffer (return to 530 value).
    I've tested all this libraries with WS2811 ledstrip but with only one output and two universes (280 RGB leds) and worked fine.

  8. #8
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    I've replace Ethernet library by Paul's Ethernet library(W5500 fork) and no progress.
    I use this ethernet module:https://www.aliexpress.com/item/Free...0-06aab7d6a51d

    That could be the problem...

  9. #9
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by manitou View Post
    Nice work from alex-arc.
    I tried his blackled sketch. Artpoll works perfectly but i've got same results + a color problem (only white channel)
    Here is a vidéo:https://youtu.be/9t1qzH4T0X0
    I don't know if SK6812 protocol is different from WS2811 RGBW.

  10. #10
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    On my original sketch, i tried to use only 2 outputs (const byte numStrips= 2
    and so i manage 2240 channels so 5 universes and i get same result, universe 0 to 3 is ok and 4-5 universes are bad.
    I could think that's not a problem of memory or buffer size because 5 universes (560 RGBW leds) is not so big.
    It's strange that Universe 3 works fine and Universe 4 immediatly lagging...

  11. #11
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Not sure if this can help but a couple years back I remember that forcing the Ethernet adapter speed to 10mbos on my computer helped with performance issues on the wiz820io. Might be worth trying...

  12. #12
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by nlecaude View Post
    Not sure if this can help but a couple years back I remember that forcing the Ethernet adapter speed to 10mbos on my computer helped with performance issues on the wiz820io. Might be worth trying...
    Thank you nlecaude. It's a liittle better. I can get the universe 4 but it's still jerky.

  13. #13
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    899
    I am pretty sure that a few years back, there was a need to change a buffer size, ethernet UDP buffer size? to accept all incoming before processing. I will see if I can't dig it out.

  14. #14
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Thank you Crees to show your sketch here: https://forum.pjrc.com/threads/45760...091#post152091

    I already use one socket ethernet library, so the problem is probably that I'm not waiting the reception of all universes. before leds.show();
    The original code did that:
    Code:
    /*if (universe < maxUniverses)
        universesReceived[universe] = 1;
    
      for (int i = 0 ; i < maxUniverses ; i++)
      {
        if (universesReceived[i] == 0)
        {
          //Serial.println("Broke");
          sendFrame = 0;
          break;
        }
      }
    */
    The problem is that Madmapper only sends Universe that have changed except one packet each 4 seconds as defined in official ArtNet spec and the check of a number of universe received don't work.
    I'm not a developper (I try to manage different libraries and put them together to get what I want) so i don't know what is the way to check universes received...
    For the moment I will use 1 teensy per bar (280 leds) because I need at least 6 bars for a festival this weekend.
    So i'll continue next week.
    Perhaps i will give up my code and try to use alex-arc's blackled sketch because artnode functions are really impressive (automatic send IP and universe to madmapper)and according to ArtNet spec.
    Thank you for your help.

  15. #15
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Hi. I'm back.
    A madmapper developper say: "The code you use is wrong, it should use the ArtSync packet (synchronize) that MadMapper sends after having processed DMX output"
    So I try alex-arc sketch here: https://github.com/vertigo-dk/BlackLED
    Same issue, First 3 universes ok and next are lagging.
    Alex-arc's sketch uses the Artsync packet, Madmapper sees all my fixtures on the ethernet (very, very usefull) but always the same problem.
    Here is my sketch:
    Code:
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // initial user defined settings
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    #define NUM_OF_OUTPUTS 4
    #define MAX_NUM_LED_PER_OUTPUT 280
    #define NUM_CHANNEL_PER_LED 4 // do not change this
    
    //#define blackOnOpSyncTimeOut //recoment more than 20000 ms
    //#define blackOnOpPollTimeOut //recoment more than 20000 ms
    const static uint32_t OpSyncTimeOut = 300000;
    const static uint32_t OpPollTimeOut = 30000;
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // definitions calculated from user settings
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    const int num_channel_per_output = MAX_NUM_LED_PER_OUTPUT * NUM_CHANNEL_PER_LED;
    
    const int num_universes_per_output = (num_channel_per_output%512) ? num_channel_per_output/512+1 : num_channel_per_output/512;
    
    const int num_led_per_output = num_universes_per_output*512/NUM_CHANNEL_PER_LED;
    
    const int num_artnet_ports = num_universes_per_output*NUM_OF_OUTPUTS;
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // includes and lib
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    #include <SPI.h>
    #include <Ethernet.h>
    #include <ArtNode.h>
    #include "ArtNetFrameExtension.h"
    
    #include <OctoWS2811.h>
    
    #include "TeensyMAC.h"
    #include <EEPROM.h>
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // settings error check
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    #if F_BUS < 60000000
    #error "Teensy needs to run at 120MHz to read all packets in time"
    #endif
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // real code starts hear
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    #define VERSION_HI 0
    #define VERSION_LO 9
    
    #define PIN_RESET 9
    
    EthernetUDP udp;
    uint8_t udp_buffer[600];
    
    boolean locateMode = 0;
    
    // variables for the node.report
    float tempVal = 0;
    float fps = 0;
    float avgUniUpdated = 0;
    uint8_t numUniUpdated = 0;
    unsigned long currentMillis = 0;
    unsigned long previousMillis = 0;
    
    uint32_t lastPoll = 0;
    uint32_t lastSync = 0;
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // octoWS2811
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    uint32_t dmxMemory[num_led_per_output * 8];
    DMAMEM uint32_t displayMemory[num_led_per_output * 8];
    uint32_t drawingMemory[num_led_per_output * 8];
    
    const int LEDconfig = WS2811_RGBW | SK6812_820kHz;
    
    OctoWS2811 LEDS(num_led_per_output, displayMemory, drawingMemory, LEDconfig);
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // Art-Net config
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    ArtConfig config = {
      {0xDE, 0xAD, 0xBE, 0x00, 0x00, 0x00}, // MAC - last 3 bytes set by Teensy
      {2, 0, 0, 1},                         // IP
      {255, 0, 0, 0},                       // Subnet mask
      0x1936,                               // UDP port
      false,                                // DHCP
    
      // These fields get overwritten by loadConfig:
      0, 0,                                 // Net (0-127) and subnet (0-15)
      "BlackLED_6",                           // Short name
      "BlackLED_6_port",                     // Long name
      num_artnet_ports, // Number of ports
      { PortTypeDmx | PortTypeOutput,
        PortTypeDmx | PortTypeOutput,
        PortTypeDmx | PortTypeOutput,
        PortTypeDmx | PortTypeOutput
      }, // Port types
      {0, 0, 0, 0},                         // Port input universes (0-15)
      {0, 1, 2, 3},                          // Port output universes (0-15)
      VERSION_HI,
      VERSION_LO
    };
    
    ArtNodeExtended node;
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // artnetSend - takes a buffer pointer and its length
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void artnetSend(byte* buffer, int length) {
      udp.beginPacket(node.broadcastIP(), config.udpPort);
      udp.write(buffer, length);
      udp.endPacket();
    }
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // Blink test all the leds r,g,b,w
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void blink() {
      for (int i = 0 ; i < 8 * num_led_per_output ; i++)
        LEDS.setPixel(i, 127, 0, 0, 0);
      LEDS.show();
      delay(1000);
      for (int i = 0 ; i < 8 * num_led_per_output  ; i++)
        LEDS.setPixel(i, 0, 127, 0, 0);
      LEDS.show();
      delay(1000);
      for (int i = 0 ; i < 8 * num_led_per_output  ; i++)
        LEDS.setPixel(i, 0, 0, 127,0);
      LEDS.show();
      delay(1000);
      for (int i = 0 ; i < 8 * num_led_per_output  ; i++)
        LEDS.setPixel(i, 0, 0, 0, 127);
      LEDS.show();
      delay(1000);
      for (int i = 0 ; i < 8 * num_led_per_output  ; i++)
        LEDS.setPixel(i, 0, 0, 0, 0);
      LEDS.show();
    }
    
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // EEPROM setup
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    // ID of the settings block
    #define CONFIG_VERSION "ls1"
    
    // Tell it where to store your config data in EEPROM
    #define CONFIG_MEM_START 16
    #define CONFIG_START 17
    #define CONFIG_END 2
    
    int oemCode = 0x0000; // OemUnkown
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // loadConfig - loads configurations from EEPROM
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void loadConfig() {
      // To make sure there are settings, and they are YOURS!
      // If nothing is found it will use the default settings.
      if (EEPROM.read(CONFIG_MEM_START + 0) == CONFIG_VERSION[0] &&
          EEPROM.read(CONFIG_MEM_START + 1) == CONFIG_VERSION[1] &&
          EEPROM.read(CONFIG_MEM_START + 2) == CONFIG_VERSION[2]) {
        for (unsigned int t = CONFIG_START; t < sizeof(config) - CONFIG_END; t++) {
          *((char*)&config + t ) = EEPROM.read(CONFIG_MEM_START + t + 3 - CONFIG_START);
        }
      }
    }
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // saveConfig - saves configurations to EEPROM
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void saveConfig() {
      EEPROM.write(CONFIG_MEM_START + 0, CONFIG_VERSION[0]);
      EEPROM.write(CONFIG_MEM_START + 1, CONFIG_VERSION[1]);
      EEPROM.write(CONFIG_MEM_START + 2, CONFIG_VERSION[2]);
      for (unsigned int t = CONFIG_START; t < sizeof(config) - CONFIG_END; t++) {
        EEPROM.write(CONFIG_MEM_START + t - CONFIG_START + 3, *((char*)&config + t));
      }
    }
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // setup
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void setup() {
      //saveConfig(); //<-- uncomment to force the EEPROM config to your settings on eatch reboot
      ArtConfig tempConfig = config;
      loadConfig();
      config.numPorts = tempConfig.numPorts;
      config.numPorts = tempConfig.numPorts;
      config.verHi = tempConfig.verHi;
      config.verLo = tempConfig.verLo;
      saveConfig();
    
    
    #ifdef PIN_RESET
      pinMode(PIN_RESET, OUTPUT);
      digitalWrite(PIN_RESET, LOW);
      delayMicroseconds(2);
      digitalWrite(PIN_RESET, HIGH);
      delay(150);
    #endif
    
      // Read MAC address
      mac_addr mac;
      for (int i = 3; i < 6; i++) {
        config.mac[i] = mac.m[i];
      }
    
      // Calculate IP address
      config.ip[0] = 2;
      config.ip[1] = config.mac[3] + (oemCode & 0xFF);// + ((oemCode >> 16) & 0xFF);
      config.ip[2] = config.mac[4];
      config.ip[3] = config.mac[5];
    
      // Open Ethernet connection
      IPAddress gateway(config.ip[0], 0, 0, 1);
      IPAddress subnet(255, 0, 0, 0);
    
      Ethernet.begin(config.mac, config.ip,  gateway, gateway, subnet);
      udp.begin(config.udpPort);
    
      // Open ArtNet
      node = ArtNodeExtended(config, sizeof(udp_buffer), udp_buffer);
    
      LEDS.begin();
      LEDS.show();
    
      blink();
    
      // to read internal temperature
      analogReference(INTERNAL);
      analogReadResolution(12);
    
    }
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // main loop
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void loop() {
      while (udp.parsePacket()) {
        // First read the header to make sure it's Art-Net
        unsigned int n = udp.read(udp_buffer, sizeof(ArtHeader));
        if (n >= sizeof(ArtHeader)) {
          ArtHeader* header = (ArtHeader*)udp_buffer;
          // Check packet ID
          if (memcmp(header->ID, "Art-Net", 8) == 0) {  //is Art-Net
            // Read the rest of the packet
            udp.read(udp_buffer + sizeof(ArtHeader), udp.available());
            // Package Op-Code determines type of packet
            switch (header->OpCode) {
    
              // Poll packet
              case OpPoll: {
                  //T_ArtPoll* poll = (T_ArtPoll*)udp_buffer;
                  //if(poll->TalkToMe & 0x2){
    
                  #ifdef blackOnOpPollTimeOut
                    lastPoll = millis();
                  #endif
    
                  float tempCelsius = 25.0 + 0.17083 * (2454.19 - tempVal);
                  sprintf(node.pollReport, "numOuts;%d;numUniPOut;%d;temp;%.1f;fps;%.1f;uUniPF;%.1f;", NUM_OF_OUTPUTS, num_universes_per_output, tempCelsius, fps, avgUniUpdated);
                  node.createPollReply(); //create pollReply
                  artnetSend(udp_buffer, sizeof(ArtPollReply)); //send pollReply
                  //}
                  break;
                }
    
              // DMX packet
              case OpDmx: {
                  ArtDmx* dmx = (ArtDmx*)udp_buffer;
                  int port = node.getAddress(dmx->SubUni, dmx->Net) - node.getStartAddress();
                  if (port >= 0 && port < config.numPorts) {
                    uint16_t portOffset = port * 512/NUM_CHANNEL_PER_LED;
    
                    //write the dmx data to the Octo frame buffer
                    uint32_t* dmxData = (uint32_t*) dmx->Data;
                    for (int i = 0; i < 128; i++) {
                      LEDS.setPixel(i + portOffset, dmxData[i]);
                    }
                    numUniUpdated++;
                  }
                  break;
                }
    
              // OpSync
              case 0x5200: {
                  LEDS.show();
    
                  #ifdef blackOnOpSyncTimeOut
                    lastSync = millis();
                  #endif
    
                  // calculate framerate
                  currentMillis = millis();
                  if(currentMillis > previousMillis){
                    fps = 1 / ((currentMillis - previousMillis) * 0.001);
                  } else {
                    fps = 0;
                  }
                  previousMillis = currentMillis;
    
                  // calculate average universes Updated
                  avgUniUpdated = numUniUpdated * 0.16 + avgUniUpdated * 0.84;
                  numUniUpdated = 0;
    
                  break;
                }
    
              // OpAddress
              case OpAddress: {
    
                  T_ArtAddress * address = (T_ArtAddress*)udp_buffer;
    
                  if (address->LongName[0] != 0) {
                    memcpy(config.longName, address->LongName, 64);
                  }
                  if (address->ShortName[0] != 0) {
                    memcpy(config.shortName, address->ShortName, 18);
                  }
                  if (address->NetSwitch != 0x7F) {               // Use value 0x7f for no change.
                    if ((address->NetSwitch & 0x80) == 0x80) { // This value is ignored unless bit 7 is high. i.e. to program a  value 0x07, send the value as 0x87.
                      config.net = address->NetSwitch & 0x7F;
                    }
                  }
                  if (address->SubSwitch != 0x7F) {               // Use value 0x7f for no change.
                    if ((address->SubSwitch & 0x80) == 0x80) { // This value is ignored unless bit 7 is high. i.e. to program a  value 0x07, send the value as 0x87.
                      config.subnet = address->SubSwitch & 0x7F;
                    }
                  }
                  for (int i = 0; i < 4; i++) {
                    if (address->SwIn[i] != 0x7F) {
                      if ((address->SwIn[i] & 0x80) == 0x80) {
                        config.portAddrIn[i] = address->SwIn[i] & 0x7F;
                      }
                    }
                    if (address->SwOut[i] != 0x7F) {
                      if ((address->SwOut[i] & 0x80) == 0x80) {
                        config.portAddrOut[i] = address->SwOut[i] & 0x7F;
                      }
                    }
                  }
    
                  if (address->Command == 0x04) {
                    locateMode = true;
                  } else {
                    locateMode = false;
                  }
                  node = ArtNodeExtended(config, sizeof(udp_buffer), udp_buffer);
                  saveConfig();
                  loadConfig();
                  node.createPollReply();
                  artnetSend(udp_buffer, sizeof(ArtPollReply));
                  //node.createExtendedPollReply();
                  //artnetSend(udp_buffer, node.sizeOfExtendedPollReply());
                  break;
                }
    
              // Unhandled packet
              default: {
                  break;
                }
            }
    
            // answer routine for Art-Net Extended
          } else if (memcmp(header->ID, "Art-Ext", 8) == 0) {
            // Read the rest of the packet
            udp.read(udp_buffer + sizeof(ArtHeader), udp.available());
            // Package Op-Code determines type of packet
            switch (header->OpCode) {
              // ArtNet Frame Extension
              case OpPoll | 0x0001: {
                  node.createExtendedPollReply();
                  artnetSend(udp_buffer, node.sizeOfExtendedPollReply());
                  break;
                }
            }
          }else if(memcmp(header->ID, "MadrixN", 8) == 0){
            LEDS.show();
    
            #ifdef blackOnOpSyncTimeOut
              lastSync = millis();
            #endif
    
            // calculate framerate
            currentMillis = millis();
            if(currentMillis > previousMillis){
              fps = 1 / ((currentMillis - previousMillis) * 0.001);
            } else {
              fps = 0;
            }
            previousMillis = currentMillis;
    
            // calculate average universes Updated
            avgUniUpdated = numUniUpdated * 0.16 + avgUniUpdated * 0.84;
            numUniUpdated = 0;
          }
        }
      }
    
      // read temperature value
      tempVal = analogRead(38) * 0.01 + tempVal * 0.99;
    
      #ifdef blackOnOpSyncTimeOut
        currentMillis = millis();
        if (currentMillis - lastSync > OpSyncTimeOut) {
          for (int i = 0; i < num_led_per_output * 8; i++) {
            LEDS.setPixel(i, 0);
          }
          LEDS.show();
        }
      #endif
    
      #ifdef blackOnOpPollTimeOut
        currentMillis = millis();
        if (currentMillis - lastPoll > OpPollTimeOut) {
          for (int i = 0; i < num_led_per_output * 8; i++) {
            LEDS.setPixel(i, 0);
          }
          LEDS.show();
        }
      #endif
    }

  16. #16
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    It must be a problem with W5500.
    When using paul's ethernet library i uncomment //#define W5500_4K_BUFFERS but no results.
    When using Alex-Arc's Ethernet library, i can see that the value is #define W5200_16K_BUFFERS .

    So how can i modify Ethernet library to have a #define W5500_16K_BUFFERS option?

    Perhaps I can do that but i don't know exactly what is right and if there are not other lines to modify
    Code:
    else if (isW5500()) {
    		CH_BASE = 0x1000;
                   #ifdef W5500_16K_BUFFERS
    		SSIZE = 16384;    // 4K buffers
    		SMASK = 0x0FFF;
    		#else
    		#ifdef W5500_4K_BUFFERS
    		SSIZE = 4096;    // 4K buffers
    		SMASK = 0x0FFF;
    		#else
    		SSIZE = 2048;    // 2K buffers
    		SMASK = 0x07FF;
    		#endif
    		TXBUF_BASE = 0x8000;
    		RXBUF_BASE = 0xC000;
    		#ifdef W5500_4K_BUFFERS
    		for (i=0; i<MAX_SOCK_NUM; i++) {
    			writeSnRX_SIZE(i, SSIZE >> 10);
    			writeSnTX_SIZE(i, SSIZE >> 10);
    		}
    		for (; i<8; i++) {
    			writeSnRX_SIZE(i, 0);
    			writeSnTX_SIZE(i, 0);
    		}
    #endif
    Do someone uses W5500 with artnet?

  17. #17
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    There are a lot of lines using #ifdef W5500_4K_BUFFERS but i'm not able to modify all the parameters to match to my new parameter #ifdef W5500_16K_BUFFERS

    Example: #ifdef W5500_4K_BUFFERS
    SPIFIFO.write16(((addr << 1) & 0x6000) | 0x1C00 | *buf++, // 4K buffers

    If someone could help me to understand, it's too difficult now.

  18. #18
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Alex-Arc have already made the #ifdef W5500_16K_BUFFERS here: https://github.com/alex-Arc/Ethernet...SPI1_max_speed
    He 's working on SPI1 so i need to change SPI1 for SPI and SPIFIFO1 for SPIFIFO. That's ok
    He told me to compile 120 Mhz. That's ok
    He told me to add the 30MHz prescaler to the SPIFIFO.h. That's not OK. Where is this file?
    Is it/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/SPIFIFO.h?
    Do i need to add
    #define SPI_CLOCK_30MHz (SPI_CTAR_PBR(?) | SPI_CTAR_BR(?) | SPI_CTAR_DBR)


    and what are the values of SPI_CTAR_PBR and SPI_CTAR_BR???

  19. #19
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    YEEEEESSSSSSS!
    I wasn't replacing the right ethernet library!
    I was changing the Arduino/contents/java/library but this isn't used when using teensy.
    I needed to replace this:/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Ethernet
    Thank's to Alex-Arc and Paul for your very nice work.
    I still have a problem with color order but the 11 universes work fine.

  20. #20
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    899
    thats very good news to have all universe working. So, to sum up, you have the sketch in post #15 working with Alex-Arc ethernetSPI1?

  21. #21
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Yes. I've just modified the Ethernet library to work with SPI (not SPI1) and it's working with W5500 (WIZ850 chinese clone), 16K buffer, one socket. I've got just alittle problem of color order but the problem could come from MadMapper. Thank you Mortonkopf.

  22. #22
    Junior Member
    Join Date
    Nov 2016
    Posts
    5
    I'm having the same problem here. My question is, is it possible to use the nactl example OctoWS2811 example with over 3 universes with some sort of modification or is blackled the only other viable option for more than 3 universes?

  23. #23
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    The Artnet Library works with more than 3 universes, this is a specific issue with MadMapper, is this the software you are using to send ?

  24. #24
    Junior Member
    Join Date
    Nov 2016
    Posts
    5
    Resolume Arena - 4th universe on is laggy/inconsistent

  25. #25
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    I’ll see if I have time to implement art-sync packets.
    Reading the post it does seem some tweaks are necessary in the Ethernet library though...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •