multiple teensy's

morry

Member
I have two teensy's with octows2811's but I can only get the first RJ45 to work on each octows2811 what am I missing?
Code:
/*
************************  Heinz Doessegger  -  www.technikfreak.ch  ******************************

Vchristmas v1.0 - January 2015
Documentation for the project:
Http://www.technikfreak.ch/category/technik-elektronik/technik-elektronik-projekte/technik-elektronik-projekte-weihnachtsbeleuchtung/

HARDWARE: TEENSY 3.1 / 3.2

ARDUINO PLUGIN: TEENSYDUINO with OctoWS2811 library
Http://www.pjrc.com/teensy/td_download.html

LED: WS2811

SOFTWARE: Vixen Lights 3.x
Program to control WS2811 RGB LED by Vixen Lights 3.x http://www.vixenlights.com/
DISPLAY CONFIGURATION - COMx (x = COM port of Arduino) 115200, None, 8 One
SEND A TEXT HEADER: VIXStart
Channels: Pro LED requires 3 channels (red / green / blue)
Color Handling: RGB

TIP: For beginners
Start with a 50 series LED. LedsPerStrip and PixelCount to 50.
In Vixen Lights, create 50 LED elements and map to 150 outputs via the Color Handling RGB.

************************  Heinz Doessegger  -  www.technikfreak.ch  ******************************
*/

#include <OctoWS2811.h>

const int ledsPerStrip = 1200;              // Maximum number of pixels per string
int   PixelCount = 4800;                      // Effective number of pixels
float hell = .65;                          // Dimmer 1.00 = 100% brightness - 0.50 = 50% brightness

DMAMEM int displayMemory[ledsPerStrip*6];
int drawingMemory[ledsPerStrip*6];
const int config = WS2811_GRB | WS2811_800kHz;
OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
int pixelValue = 0;

void setup()
{
  delay(300);
  Serial.begin(115200);                     // Speed of data transmission from Vixen Lights 3 to the Arduino

  leds.begin();
  for (int i=0;i<PixelCount;i++)            // Initialization - Once all LEDs light up blue
     {
       leds.setPixel(i, 200*hell, 0, 0);
     }
       leds.show();   
     delay (5000); 
  for (int i=0;i<PixelCount;i++)
     {
       leds.setPixel(i, 0, 0, 0);
     }
     leds.show();   
}

void loop()
{                   
 
    if (Serial.available()>5)                // Wait for data transmission from Vixen Lights
  {
     waitForVixenHeader();                   // Call function: Waiting for start string
 
    for (int pixCount=0; pixCount<PixelCount;pixCount++)       // Do this for as many Pixels defined in PixelCount
    {
      int RGB[3];                             // Array for the three RGB color valuesArray for the three RGB color values                   
      for (int color = 0;color<3;color++)     // Three values each form one RGB LED
      {                       
        while (Serial.available() < 1)        // Wait for the next number
        {
          delay(10);
        }
        RGB[color] = int(Serial.read()*hell); // Assign color value to the array with brightness correction
      }                                       // Repeat until all three values are read
          
        leds.setPixel(pixCount, RGB[1], RGB[0], RGB[2]);
      
    }                                         // Repeat until all LEDs are read
    leds.show();                              // Activate color patterns                             
  }                                           // Get the next color pattern
}                                             // Loop end

void waitForVixenHeader()
{
    char *header="VIXStart";
    char buffer[8];
    int index = 0;

    while (true)
    {
        int inByte = Serial.read();
        if(inByte==-1)
        {
          continue;
        }
        
        buffer[index] = inByte;
        if(buffer[index]!=header[index])
        {           
            index=-1;                     
        }
        
        buffer[index+1] = 0;             
        index++;
        if(index==8)
        {
          return;
        }
    }
}
 
I think it's because of these lines:
C++:
const int ledsPerStrip = 1200;              // Maximum number of pixels per string
int   PixelCount = 4800;                    // Effective number of pixels
4800 LEDs divided by 1200 LEDs per strip is 4 strips.
See the picture below from this page:

1713463891671.png


If you want to use all 8 outputs (over both RJ45's), you have to set const int ledsPerStrip = 600;.

Paul

PS: you need to correctly set the buffers as well. From the Teensy4_Pinlist.ino example:
C++:
// These buffers need to be large enough for all the pixels.
// The total number of pixels is "ledsPerStrip * numPins".
// Each pixel needs 3 bytes, so multiply by 3.  An "int" is
// 4 bytes, so divide by 4.  The array is created using "int"
// so the compiler will align it to 32 bit memory.
const int bytesPerLED = 3;  // change to 4 if using RGBW
DMAMEM int displayMemory[ledsPerStrip * numPins * bytesPerLED / 4];
int drawingMemory[ledsPerStrip * numPins * bytesPerLED / 4];
 
Last edited:
My mistake I thought led limits were per data line when in actual fact they are per teensy then depending on how many pixels pre data line determines how many data line are used. Thanks for the update.
 
I think it's because of these lines:
C++:
const int ledsPerStrip = 1200;              // Maximum number of pixels per string
int   PixelCount = 4800;                    // Effective number of pixels
4800 LEDs divided by 1200 LEDs per strip is 4 strips.
See the picture below from this page:

View attachment 34061

If you want to use all 8 outputs (over both RJ45's), you have to set const int ledsPerStrip = 600;.

Paul

PS: you need to correctly set the buffers as well. From the Teensy4_Pinlist.ino example:
C++:
// These buffers need to be large enough for all the pixels.
// The total number of pixels is "ledsPerStrip * numPins".
// Each pixel needs 3 bytes, so multiply by 3.  An "int" is
// 4 bytes, so divide by 4.  The array is created using "int"
// so the compiler will align it to 32 bit memory.
const int bytesPerLED = 3;  // change to 4 if using RGBW
DMAMEM int displayMemory[ledsPerStrip * numPins * bytesPerLED / 4];
int drawingMemory[ledsPerStrip * numPins * bytesPerLED / 4];
FYI I made these changes to code and it stopped working all together maybe because I have a teensy3.2 not 4 still have problem got the data line issues figured out but in FPP sequences play correct in test mode but when I go to play mode lights are all screwed up?
 
Can you share the complete code that "stopped working"?

Paul
I think I might know but don't know for sure what the problems is. I think it is someting I did in xlights but not sure what. I built some new props and down loaded a sample sequence to test and imported into xlights. I like it so I decide to use it in my show so I added effects to my normal props for the whole song. when I test it in FPP it displays properly but it doest play the music so though all was good but when I play it in a show my new showstopper spinner prop is all messed up. Any way I reimported the sequence then add effect to just spinner prop and all works fine. What ever i did on the other sequence it looked like other prop effects were stepping on my spinner prop but it would only happen when music and sequence were playing at the same time. wish I knew what I did?
 
Back
Top