none
I2C Driver - DeviceIoControl returns INVALID_HANDLE_VALUE RRS feed

  • Question

  • Hi

    We have connected our LVDS to Intel BayTrail board through I2C and we are using the I2C driver provided by Intel. We are following the Intel software manual to write the application for configuring EDID data. 

    I have opened the driver handled and the handle is also valid but when i try to call DeviceIoControl for IOCTL_I2C_EXECUTE_WRITE, i am getting the error code of 6 ( INVALID_HANDLE_VALUE ). 

    I have simply followed the steps mentioned in the driver user manual as below,

    #include “public.h”
    
    I2C_SINGLE_TRANSMISSION writeTransmission;
    UCHAR writeBuf[BUF_SIZE] = {0x01,0x02};
    UINT16 slaveAdr = 0x1C;
    
    writeTransmission.Address = slaveAdr;
    writeTransmission.AddressMode = AddressMode7Bit;
    writeTransmission.BusSpeed = I2C_BUS_SPEED_400KHZ;
    writeTransmission.DataLength = sizeof(writeBuf);
    writeTransmission.pBuffer = writeBuf;
    
    status = DeviceIoControl(
    fileHandler,
    IOCTL_I2C_EXECUTE_WRITE,
    &writeTransmission,
    sizeof(writeTransmission),
    NULL,
    0,
    NULL,
    &Overlapped);
    if(status || (GetLastError() == ERROR_IO_PENDING))
    {
         status = GetOverlappedResult(
                      fileHandler,
                      &Overlapped,
                      &bytesReturned,TRUE);
    if(status)
    {
        printf("Write is passed\r\n");
    }
    else
        printf("error = 0x%x",GetLastError() );
    }
    }

    Can you please help on this?

    Thanks in Advance.


    Wednesday, September 9, 2015 10:41 AM

Answers

  • I2C_SINGLE_TRANSMISSION and this device interface is not a Microsoft defined interface, you need to talk to the vendor (I would guess intel)

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, September 9, 2015 4:47 PM