4765

DMX512 is the official standard for transmitting up to 512 channels of lighting signals (a DMX universe) over a standard 2-wire half duplex RS485 interface. At first glance, generating DMX signals seems simple. This is a dangerous misconception, to implement DMX correctly you must be aware of the details and also how to verify them. This article will show you these details and 3 different ways to implement DMX correctly. By using a standard RS485 transceiver we implement 3 flavors.

Demonstration of 3 technologies side by side : 
1) old style UART MCU (not scalable, timing issues)
2) raspberry-pi pico PIO assembly using micropython (limited scaling)
3) FPGA technology demonstrating verilog and wishbone bus (unlimited scaling)
 
Shows how to create transmitters and receivers with accurate signal timing. 
DMX needs extra care because of frame start detection using Mark/Space/Break detection, this makes implementation non-trivial.
Language for RPI2-Pico : micropython + pio assembly
Language for FPGA : Verilog

Used hardware:
MCU : Arduino Mega2560 https://www.elektor.nl/arduino-mega-2560-rev3
FPGA : Sipeed Tang Nano 9K Fpga https://wiki.sipeed.com/hardware/en/tang/Tang-Nano-9K/Nano-9K.html
Pico : RP2040 https://www.elektor.nl/wiznet-w5100s-evb-pico-rp2040-based-evaluation-board

Problems with common UART based implementations and timers/interrupt handling will be made clearly visible.
DMX hardware is also required : preferred on isolated RS485 transceiver board like : https://nl.farnell.com/digilent/410-310/evaluation-board-rs485-communication/dp/2528810
or a arduino DMX shield like : https://www.tinytronics.nl/shop/nl/communicatie-en-signalen/serieel/rs-485/dfrobot-dmx-shield-voor-arduino

Challenges : 
* correct creation of DMX signal including Mark/space/break timing.
* correct detection of DMX frame start and ending, including short frames (not full universes)
* detecting change of DMX universe size
* detection of framing errors
* handling other tasks while doing DMX, using interrupts or DMA or other tricks
* testing the implementations for correctness and corner cases

This article will show common pitfalls for DMX timing and running other tasks at the same time.
Read code will be created step by step and explained based on the specific hardware/software implementation.
This is a 3 course meal, enjoy.
#oetelx

==== Nederlands ====

Demonstratie van 3 technologieën naast elkaar : 
1) oude stijl UART MCU (niet schaalbaar, timing problemen)
2) raspberry-pi pico PIO assemblage met micropython (beperkte schaalbaarheid)
3) FPGA-technologie met gebruik van verilog en wishbone bus (onbeperkte schaalbaarheid)
 
Toont hoe zenders en ontvangers te maken met nauwkeurige signaal timing. 
DMX heeft extra aandacht nodig vanwege frame start detectie met Mark/Space/Break detectie, einde frame is niet-triviaal.

Taal voor Arduino : 'C' 
Taal voor RPI2-Pico : micropython + pio assembly
Taal voor FPGA : Verilog

Gebruikte hardware:
MCU en/serieel/rs-485/dfrobot-dmx-shield-voor-arduino

Uitdagingen : 
* correcte generatie van DMX signaal inclusief Mark/space/break timing.
* correcte detectie van DMX frame start en einde, inclusief korte frames (niet volledige universums)
* detecteren van verandering van DMX universum grootte
* detectie van framing fouten
* afhandeling van andere taken terwijl DMX bezig is, met gebruik van interrupts of DMA of andere trucs
* testen van de implementaties op juistheid en onvoorziene situaties

Dit artikel zal veel voorkomende valkuilen laten zien voor DMX timing en het uitvoeren van andere taken op hetzelfde moment.
Implementaties worden stap voor stap getoond en uitgelegd op basis van de specifieke implementatie-eigenschappen van de hardware en software.
.
Dit is een 3 gangen menu, geniet ervan.