daliserver
daliserver copied to clipboard
Support for 24 bit frames
As stated here
https://github.com/sde1000/python-dali/issues/10#issuecomment-141428280
it would be good to have 24 bit frame support in daliserver.
In particular, it would be nice to have support in the network protocol even if we don't yet know how to get the device to send them!
I absolutely agree.
Did you find out how Tridonic transmits 24bit messages on the USB port already? I currently lack the time to do more reverse engineering myself.
I'm also not particularly familiar with the 24bit DALI protocol (free access to the standards would be handy...), so any hints on the data format would be appreciated. Do I just add another message octet to the frame? Or do I need to include more information?
I don't have a test rig to do reverse-engineering on the DALI-USB at the moment. (I've had to put my test device into service because one of the ones in service was damaged during flooding - funnily enough, they aren't waterproof and the power on the DALI interface staying on while the device is wet causes all kinds of interesting galvanic corrosion!)
According to IEC 62386-101, a forward frame can have an arbitrary number of data bits in addition to the start bit and stop condition. The standard defines 16- and 24-bit forward frames, notes that frames with 20 or 32 bits are "reserved and shall not be used", and declares all other frame sizes to be "proprietary". There is also a hint that proprietary forward frames of between 8 and 15 bits should be avoided because some receivers may have trouble distinguishing them from overlapping backward frames.
Backward frames are always responses to forward frames and always have 8 data bits.
Forward frames are sent with a "priority" of 1 through 5 which sets the minimum and maximum time the transmitter waits between the bus going idle and the start of transmission. A "transaction" consists of a forward frame with priority 2..5 followed by a number of forward frames with priority 1. "Send-twice" commands should always be transmitted as a transaction.
Humm. Ok. I have no idea where exactly the priority comes in, but I guess it's part of the DALIUSB message.
My test rig consisted of a Linux PC, a DALISUB, usbmon, VirtualBox and a Windows XP VM. External DALI devices were some lamps, a few push buttons and an IR sensor with included IR remote receiver. See https://www.kernel.org/doc/Documentation/usb/usbmon.txt for more info on usbmon.
I've done some more testing using VirtualBox, masterCONFIGURATOR and Wireshark. Relevant to this issue:
178 1494.128499 host 1.10.2 120600040000010300 eD 000103 A0 eD command 3 undefined
180 1494.154283 1.10.1 host 12740000010300cb06 ... "74" response is a 24-bit frame transmission report
182 1494.164289 1.10.1 host 127100000000008a06 ... no reply (no device at A0)
436 1495.782099 host 1.10.2 123100040000052600 eD 000526 A2 eD command 38 undefined
438 1495.813281 1.10.1 host 127400000526009131 ... 24-bit frame transmission report
440 1495.828265 1.10.1 host 127200000069005c31 Answer 69 = 105 (0x69)
1390 1501.564733 host 1.10.2 12d000040001ff3200 eD 01FF32 C1 Bcast eD command 50 undefined
1392 1501.591174 1.10.1 host 12740001ff320133d0 ... frame transmission report
1394 1501.601176 1.10.1 host 127100000000008ad0 ... no reply
So, to send a 24-bit frame you use '04' in byte 3 of the request and put the 24-bit frame in bytes 5–7. Transmission report frames have '74' in byte 1, and the 24-bit frame in bytes 3–5. The serial number of the request is in byte 8 as usual. Responses are handled in exactly the same way as 16-bit frames.
I have some more information about byte 2 of the request packets, but I'll put it in another issue.
As far as I know, eDALI is a special 25-bit protocol for Tridonic. It is not the standard 24-bit frame defined for control device communication in IEC 62386 standard. So be careful when you use this message type.
And since Tridonic USB-DALI is actually ODMed module from Lunatone, you can check more details of this device with user manual and DALI cockpit software from Lunatone.
Reference link: https://www.lunatone.com/en/product/dali-usb/
Interesting. I'll have to borrow a storage scope to see what's actually going on on the wire when one of these frames is sent.
Unfortunately the Lunatone documentation doesn't appear to cover the DALI USB protocol.
Perhaps we should finally design and build a custom DALI USB interface to address the terrible lack of documentation? Or a Raspberry Pi Hat?
Perhaps we should finally design and build a custom DALI USB interface to address the terrible lack of documentation? Or a Raspberry Pi Hat?
Would it be possible to prototype something with an Arduino?
UPDATE With a quick google search i found this https://www.hackster.io/NabiyevTR/simple-dali-controller-506e44
Perhaps we should finally design and build a custom DALI USB interface to address the terrible lack of documentation? Or a Raspberry Pi Hat?
Actually we as a company have built one with integrated DALI bus power supply. The firmware is not totally finished and not considered to be open- sourced at this moment. But if you guys are interested in the hardware, we can provide the unit for your own firmware implementation. It is based on a cost effective STM32F0 controller with USB interface.
And we do have a plan to open source the whole hardware and firmware but the date is not determined.
You can contact me whatkao#gmail.com for more details.
Perhaps we should finally design and build a custom DALI USB interface to address the terrible lack of documentation? Or a Raspberry Pi Hat?
Would it be possible to prototype something with an Arduino?
UPDATE With a quick google search i found this https://www.hackster.io/NabiyevTR/simple-dali-controller-506e44
Yes you can if you only want to use it in DIY project.
@rnixx Good find. The Arduino library mentioned there uses bit banging to drive the bus.
The circuit seems a bit primitive, though. No galvanic isolation, and the Arduino is powered directly from the DALI bus. I'm not sure I want to connect something else to that.
This circuit looks much better: https://mouser.com/applications/lighting-digitally-addressable/ It has polarity protection and galvanic isolation, as should be standard for this sort of device.