Hi all,
As you might have heard, the RaspberryPi Foundation has released their
own microcontroller (RP2040), including the development board dubbed
"Pico" that sells for $4:
https://www.raspberrypi.org/blog/raspberry-pi-silicon-pico-now-on-sale/.
When I read the specs and found out about the "Programmable IO" blocks,
I wanted to send DMX512 with it. Lots of DMX512 ;)
The result is an USB DMX interface that sends 16 universes in parallel.
And of course I wanted it to be controlled from OLA since that gives me
the possibilities to go from sACN to the RP2040-based interface (and all
the other goodies I don't need to tell you about).
The DMX-generation idea is taken from
https://web.archive.org/web/20190307175432/http://www.jonshouse.co.uk/rpidmx512.cgi:
A wavetable is generated by the CPU and then "clocked out" the GPIOs
pins by the PIO, 16 bits parallel at a time.
One of the requirements I had in mind is that it should work in QLC+ and
QLA without any changes to the existing software (at least with one
universe output) and ideally on Windows (which some of my friends
"still" use) and Linux.
The great thing about the RP2040 is that in contrast to many (all?)
ESP32-based boards, it doesn't have an USB-to-Serial chip with hardcoded
VENDOR and PRODUCT id. Instead, the USB stack is fully
software-controllable. And it supports host and device role. That means
that one is pretty free regarding the USB interface to the host.
Taking all this into account, I decided to mimic a "DMXControl Projects
e.V. Nodle U1" = "Digital Enlightment Interface USB DMX" = "Frank
Sievertsen FX5". They are based on the HID-protocol (as such, they work
driverless in Windows and Linux) and are supported out-of-the-box in
QLC+ and OLA (OLA uses libusb instead of the HID-driver). The protocol
does have its own limitations, but it can also be easily extended to
support more then one universe.
I decided against emulating an ENTTEC-based device, although they are
quite popular (including clones) since QLC+ usually supports them only
via libftdi and I fear that it might raise legal problems when the
dongle pretends to be a device including a FTDI chip.
The code is (of course) not 100% finished and polished but it works. In
addition to the HID interface, the USB devices provides a CDC ACM
"serial" interface that I currently use for debugging. However, that
could also be used to emulate a "serial" based interface protocol (maybe
even a new one with advanced features).
In theory, DMX IN or even RDM would be possible. The code to do UART TX
and UART RX using the RP2040's PIO-blocks is ready to be used:
https://github.com/raspberrypi/pico-examples/tree/master/pio/uart_rx
https://github.com/raspberrypi/pico-examples/tree/master/pio/uart_tx
I guess that implementing RDM would reduce the number of ports to 4. Or
8 with a good bit of additional code.
However, my personal interest is more into DMX sending and I don't have
access to RDM-capable fixtures to do some real life tests.
Enough talking, code for the Pico board is here:
https://github.com/kripton/pico-examples/tree/DMX16/dma/dmx16
Code/Branch for ola is here:
https://github.com/kripton/ola/tree/RP2040UsbDmx/plugins/usbdmx
It basically introduces multi-universe-sending for "all usbdmx" widgets.
It's not the cleanest change, but it works for a proof-of-concept.
TODO for the pico code is to use one GPIO PIN to drive WS2812 LEDs for
status (USB interface activity, Universe X != all zero, ...)
Of course, one cannot drive the DMX512-lines directly from the GPIOs,
RS-485 drivers are required. That makes the complete interface "a
little" more expensive than $4 but with the µC and the USB interface
already THAT cheap ...
Any comments or ideas are welcome!
Best regards,
Jannis