someweisguy / esp_dmx

Espressif ESP32 implementation of ANSI-ESTA E1.11 DMX-512A and E1.20 RDM
MIT License
335 stars 35 forks source link

DMX Read - Unstable packet.size depends on the number of DMX channels #121

Closed DenkyTuna closed 8 months ago

DenkyTuna commented 8 months ago

Describe the bug

If the number of received DMX channels is certain amount near 512ch, packet.size will be unstable.

To reproduce

Result

When the number of channel is 512, and slot 1 is fixed 0x97, Start code is 0x00 and slot 1 is 0x97 packet.size is 52 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 396 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 142 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 487 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 257 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 27 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 370 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 192 and DMX_PACKET_SIZE is 513 ..... (sometimes Serial.println("DMX was disconnected."); is called and DMX input stops.)

When the number of channel is 511, and slot 1 is fixed 0x97, Start code is 0x00 and slot 1 is 0x00 packet.size is 511 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x00 packet.size is 511 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x00 packet.size is 511 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x00 packet.size is 511 and DMX_PACKET_SIZE is 513 ....

When the number of channel is 510, and slot 1 is fixed 0x97, Start code is 0x00 and slot 1 is 0x97 packet.size is 511 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 511 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 511 and DMX_PACKET_SIZE is 513 ...

When the number of channel is 500, and slot 1 is fixed 0x97, Start code is 0x00 and slot 1 is 0x97 packet.size is 501 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 501 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 501 and DMX_PACKET_SIZE is 513 Start code is 0x00 and slot 1 is 0x97 packet.size is 501 and DMX_PACKET_SIZE is 513

Analysys

From above result, it can be said

I don't know if this is specific to M5Core or general ESP32-S3 issue.

Environment

OS: Windows 10 IDE &IDE Version: Arduino IDE 2.2.1 Repository Version: 3.1.0 (the newest one)

someweisguy commented 8 months ago

Thanks for the report. I am going to investigate this issue.

Using the base ESP32, I am unable to replicate this issue exactly. But I am seeing that when the ESP32 receives 512 slots, it reports the packet.size as 511. It reports this value consistently. I suspect these issue are related.

DenkyTuna commented 8 months ago

For temporary solution, if there is a way to "regulate" the input channel count, that will work for the people who work with small shows and don't need full 512ch capability.

someweisguy commented 8 months ago

I believe I have fixed this issue in v4.0.0. I ran some ad-hoc tests that passed. I'll close this for now; let me know if you have any questions!