I'm trying to generate DMX512 output via the Raspberry Pi's (currently a Raspberry Pi 4 Model B Rev 1.1 but I do have others) GPIOs using pigpiod and it's wave table functions (docs beginning at http://abyz.me.uk/rpi/pigpio/pdif2.html#wave_clear). The code that generates the wave table is here: https://github.com/kripton/ola_to_rpi_m ... t.cpp#L142
The idea came from this page: https://web.archive.org/web/20190307175 ... dmx512.cgi
In principle, everything is working. However, from time to time the fixtures (LED lights connected as receivers to the DMX512 signal generated by the Pi, there's a optocoupler and an RS-485 driver in between) are blinking/flickering from time to time. When the Pi is idle, there is no or very few flickering. When I SSH into the Pi via Wifi, open a text file in nano and scroll around, the flickering gets extreme.
Hooking up an oscilloscope and measuring the waveforms (screenshot attached), one can see that the timing is glitchy and the single bits (which should be exactly 4µs long each) are sometime shorter and sometimes longer.
Since the wavetables are (as far as I understand) generated by some piece of hardware (reading directly from memory and clocking the bits out), this should be independant of CPU usage. Thus, I assume that the glitches are either caused by something else using the same clock source and/or DMA channel and/or clock speed changes by either the CPU and/or the GPU.
However, I know that pigpio talks about clock sources (PWM and PCM) and DMA channels (0-~14). I've tried several solutions and none of them works reliably.
I am very fluent in configuring and compiling Linux kernels and I've tried several different configurations using both 4.19.108 and 5.4.something. The soundcard is completely disabled in the kernel and via config.txt but still I am unable to achieve a solid, jitter-free wave output.
I've tried looking into DeviceTrees (no experience so far) and tried to get some information about the Pi's hardware capabilities. However, I am unable to find suitable public documentation about the DMA and related hardware of the Pi.
On the Pi 1 B and the Pi 3 B+ it helped a lot to have NO HDMI connected when booting. However, even then the result was not 100% stable. On the Pi 4, HDMI/screen presence doesn't seem to make much of a difference
What I would like to know:
- Is it theoretically possible to have a jitter-free wavetable output at 250kBit/s on the GPIOs? Preparing them can take CPU time, that's fine but once it has started generating it, I need it jitter-free
- Is there any way (sysfs preferred) to know which DMA channels are available? Documentation about the DMA channels in general and their usage would also be nice
- Which DMA channel is currently used by which piece of hardware + driver?
- Basically the last two questions for clock sources (PWM/PCM)?
- Does removing drivers from the linux kernel's config even help me when the device tree is not altered?
Thank you for your help and looking forward to your comments!