IOW24-DG + LW14-02MOD, C++

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

Post Reply
Posts: 1
Joined: Fri Nov 16, 2018 2:08 pm

IOW24-DG + LW14-02MOD, C++

Post by Dalimann2 »

I'm trying to use the USB dongle to control DALI light, in C++/Linux, but no luck.
Dongle is working, I can see data with my oscilloscope, and windows program was able to control light. How can one turn light ON/OFF with IOW24-DG + LW14-02MOD?
Here is my code so far:

Code: Select all

void IOWarrior::iowkit_connect()
    // Open device
    devHandle = IowKitOpenDevice();
    if (devHandle == NULL) {
        qWarning() << "Failed to open device";
    // Get number of IOWs in system
    ULONG numIows = IowKitGetNumDevs();
    qDebug() << "found " << numIows << "devices";
    devHandle = IowKitGetDeviceHandle(1);
    PWCHAR snt[9];
    DWORD pid;
    IowKitGetSerialNumber(devHandle, *snt);
    pid = IowKitGetProductId(devHandle);
    IowKitSetWriteTimeout(devHandle, 1000);

void IOWarrior::IOWsetIOWtoI2Cmode() {
    //sets IOW to I2C mode
    report = {
        0x01, // report ID = 1
            0x01, // enable I2C mode
            0x00, // all flags 0 (Bit 7   - Disable Pull Ups (1 = disable) - IOW24 only (for 3.3V operation)
            //                    Bit 6   - Use Sensibus Protocol (1 = enable)
            //                    Bit 5:0 - unused, write zero
            0x00, // max timeout of 256x500 microsec (=0.128 sec)
            0x00, // must be zero
            0x00, // must be zero
            0x00, // must be zero
            0x00 //  must be zero

void IOWarrior::IOWwriteData() {
    report.ReportID = 0x02;
    report.Bytes[0] = 0xC3; // flags
    report.Bytes[1] = 0x23; // LW14_I2CADR, I2C slave Addr
    report.Bytes[2] = 0x00; // LW14_CC_OFF // LW14_CC_MAX_LEVEL = 0x05
    report.Bytes[3] = 0x00;
    report.Bytes[4] = 0x00;
    report.Bytes[5] = 0x00;
    report.Bytes[6] = 0x00;
    auto ikw = IowKitWrite(devHandle, IOW_PIPE_SPECIAL_MODE, (PCHAR)&report, IOWKIT_SPECIAL_REPORT_SIZE);
    qDebug() << "Res: " << ikw; // always returns '8'

main() {
    IOWwriteData(); // <- I can see data coming out from I2C with oscilloscope, but nothing on DALI bus

Guido Körber
Site Admin
Posts: 2762
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin

Re: IOW24-DG + LW14-02MOD, C++

Post by Guido Körber »

First of all: Are you using a battery powered computer to which IOW24 and LW14 are connected? If not you are risking your equipment. The LW14-02MOD is not galvanically isolated and intended to be used ONLY for applications where the whole application is powered off the DALI bus via the LW14-02MOD.

Use a LW14-01MOD when you are using a self powered device.

You are trying to write data into the status register of LW14 and you are not addressing the LW14. The byte containing the I2C address has to be formatted as it goes over the I2C. So you have to shift the address up by one bit: 0x46.

You should not even get an ACK from the I2C, but get an error that the transfer failed.

Then the first byte after the address is the register number. In your case you are sending a zero, which is the status register. To send a command you have to address the command register 0x01.

Next a DALI command consists of two bytes. The first one is the address. 0xFF would be broadcast to all devices on the bus.

Then after the address byte you can put the command byte.

Post Reply