Skip to content

Alignment issue on ESP32-S2 Thing Plus #15

@flupke

Description

@flupke

Starting from Example2-DMXInput and after finding this comment I changed the example to dmxSerial(1) and enPin = 3 and started receiving values from my DMX controller.

However the values read on channel 1 was changing constantly in a seemingly random way.

I tried to display 192 channels with this code from another comment in the same issue:

#include <SparkFunDMX.h>

SparkFunDMX dmx;
HardwareSerial dmxSerial(1);
uint8_t enPin = 3;
uint16_t numChannels = 192;

void setup()
{
    Serial.begin(115200);
    Serial.println("SparkFun DMX Example 2 - Input");

    dmxSerial.begin(DMX_BAUD, DMX_FORMAT);
    dmx.begin(dmxSerial, enPin, numChannels);
    dmx.setComDir(DMX_READ_DIR);

    Serial.println("DMX initialized!");
}

void loop()
{
    while(dmx.dataAvailable() == false)
    {
        dmx.update();
    }

    uint8_t data[numChannels];
    dmx.readBytes(data, numChannels, 1);
    
    for (int i=0; i < numChannels; i++) {
      if (i%32 == 0) {
        Serial.printf("\n(%3d)   ", i+1);
      }

      Serial.printf("%3d ", data[i]);
    }
    Serial.printf("\n");

    delay(1000);
}

I see values are "shifted" after each read, for example look at how the 134 89 22 sequence moves around between two reads:

  1)     0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0 
( 33)     0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0 
( 65)     0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0 
( 97)     0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0 
(129)     0   0   0   0   0   0   0   0   0   0   0   0   0 255 247   0 134  89  22   0   0   0   0   0   0   0   0   0 255 255 160 244 
(161)     0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244 

(  1)     0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0 
( 33)     0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160   0 255 255 
( 65)   160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0   0   0 
( 97)     0 255 247   0 134  89  22   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 
(129)   255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 
(161)   255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 255 255 160 244   0   0   0   0   0   0   0   0   0   0   0   0 

Does that ring a bell?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions