OpenLightingProject / ola

The Open Lighting Architecture - The Travel Adaptor for the Lighting Industry
https://www.openlighting.org/ola/
Other
647 stars 205 forks source link

Rx on plugin uartdmx #1719

Open max529 opened 3 years ago

max529 commented 3 years ago

Hi,

I bought a DMX interface (the one from bitwizard) for my raspberry pi. On the product description, it's written that the TX is implemented in OLA but not the RX. So I tried to install ola to write to the DMX interface and everything is working fine. My actual problem is : I have to know if the pi have the DMX interface or not. I searched in your code, but there is no piece of code that telling me if the DMX interface is connected.

Does someone know if this interface writting something on RX so that I can write a module that will improve the uartdmx plugin?

I used the lib pigpio to analyse changes on pin 14 and 15 (I saw changes on 14 but none on 15)

peternewman commented 3 years ago

Hi @max529 ,

I guess you're referring to this one: http://bitwizard.nl/shop/DMX-interface-for-Raspberry-pi

From a bit of guesswork and glance at the pictures, I think they mean that the TX pin is wired to the TX side of the RS485 interface, and the RX from the RX. The transmit code exists for the UART and plenty of other devices, RX (i.e. DMX input) is a bit more challenging as we have to rely on the potentially variable timing of the source device, and also we have to detect the break at the start of the DMX frame, something that is a bit abnormal so may not be built into the UART library code.

If you read the RX pin at the same time as transmitting (or sending DMX from another device), you should see activity on it. I don't think you can do this with libpigio while OLA is transmitting as the whole port will be in use, in theory something could be added within the OLA code.

Sort of related, but see some code here which tests FTDI for echo configuration and could probably be adapted for this usage: https://github.com/OpenLightingProject/ola/pull/1541/files#diff-c931b3289971f47173ddebc8f105ddaae6e3eb9921afcd76cb9feaed2f523868R432-R471

What are you trying to achieve though? I don't really think their interface is designed for hot-plugging, so why do you need to detect if it's present or not? If you really did, you could bridge a GPIO pin on the board and check for that.

To consider a different angle on this, given DMX on it's own is a uni-directional protocol, if you install the interface, but then forget to plug in the DMX cable, your improved code would correctly detect the interface, and you'd be none the wiser that DMX data wasn't getting to the lights.

FloEdelmann commented 3 years ago

Regarding UART RX, please also see #1662.

MarcHagen commented 2 years ago

ref docs from bitwizard : https://bitwizard.nl/wiki/Dmx_interface_for_raspberry_pi The DMX harware uses the 3.3V, 5V, GND, RX, TX and GPIO18 signals. Besides that the non-FTDI version breaks out the SPI bus and I2C bus.