IOError: I2C transaction failed.



  • I'm new using this module and I don't know if it's required to sed a previous byte command (0X0C) tp clarify that I want that the sensor to send me the disired data(I need the bytes 1, 2 and 7)
    I want to know the value of the parameters that sends the micS-VZ-89TE Oxygen sensor.
    0_1582836082712_38208040-bf2a-40a4-be41-d5b27cd03e2c-image.png

    What should be the value taht should be placed in the parameters named "bytes" and "direction":
    bytes = [???]
    status = i2c.writeBytes(0x70, direction, bytes)
    buffer=(i2c.readBytes(0x70,direction,7))

    If I execute the command i2cget -y 0 0x70 ??, i get the error IOError: I2C transaction failed. I am using the sensor mic VZ89TE



  • @Victor-Lucio Unfortunately you can't use Omega2's i2cget command to read multiple bytes from an I2C slave which doesn't have any register address.

    i2cget is used to read a byte or a word (two bytes) from a specified register of an I2C device.
    i2cget -y 0 <DEVICE ADDRESS> <ADDRESS> [MODE]

    • <DEVICE ADDRESS> is an I2C bus slave address (eg. 0x70 in your case)
    • <ADDRESS> is the register address on the slave from which to read data (it can be between 0x00 and 0xff)
    • The optional MODE can be one of the following:
      • b – read a byte of data, this is the default if left blank
      • w – read a word of data (two bytes)

    I'm afraid you can't use either Omega2's I2C Python Module or I2C C Library for a similar reason.



  • @György-Farkas Thank you for responding, If I wish to send the 0x0c command to get the data that I need, and knowing that the data frame must be sent as shown in the image. I'm trying to send differents ways to get the data from sensor.

    from OmegaExpansion import onionI2C
    i2c=onionI2C.OnionI2C(0)

    0_1582910532139_30110db9-cbb8-46ba-985b-78724ff00983-image.png

    I think that the next options could serve
    Option1
    Device=0x70
    Command=0x0C
    VectorBytes=[0x00, 0x00, 0x00, 0x00, 0xF3] #0xF3 is the CRC calculated
    status = i2c.writeBytes(Device,Command, VectorBytes)
    Option2
    Device=0xE0
    Command=0x0C
    VectorBytes=[0x00, 0x00, 0x00, 0x00, 0xF3] #0xF3 is the CRC calculated
    status = i2c.writeBytes(Device,Command, VectorBytes)
    Option3
    Device=0xE0
    VectorBytes=[0x0C,0x00, 0x00, 0x00, 0x00, 0xF3] #0xF3 is the CRC calculated
    status = i2c.write(Device, VectorBytes)
    Option4
    Device=0x70
    VectorBytes=[0x0C,0x00, 0x00, 0x00, 0x00, 0xF3] #0xF3 is the CRC calculated
    status = i2c.write(Device, VectorBytes)
    Option5
    Device=0x70
    AddressData=???
    size=7
    Data= i2c.readBytes(Device, AddressData, size)

    Note:
    I just tried with the option 1 and option4. The problem with the option 2()(I think that it's the correct) and option3, is that the device address is 0x70, but when i put the parameter "Device" that really is 0x70(0b1110000) but due to that the write bit is 0 , the "new address" change to E0(0b1110000). I get a error because the 0xE0 it's not a know address(don't exist).
    I don't know if I'm clear with the problem :c. I would appreciate if you could clear my doubts or helm me with an alternativeto solve my problem.



  • @Victor-Lucio Supposedly you know the I2C slave address of your sensor module and it is 0x70. Right?

    Reading the Status:

    • Master writes to Slave: address 0x70, R/W bit 0, getStatus command 0x0C, maybe 4 dummy bytes (?!) and a CRC byte.

      0_1582922536705_sending data to VZ module.png

    • Master reads from Slave: address 0x70, R/W bit 1 , no data/register address - Slave sends 6 Data bytes and a CRC byte.

      0_1582922765171_VZ response.png

    As I wrote above Omega2's i2cget is not able to read multiple bytes from an I2C slave which doesn't have any register address.
    So you have to write a program.

    Sorry, I don't know this sensor and unfortunately I don't have such sensor - so maybe i'm wrong.
    And the available "datasheets" on the net are fairly funny - or probably I'm not clever enough.
    😞



  • Thank you for responding, the real direction is 0x70 using 7 bits.
    In other words is 111-0000.
    If I include the bit of R/W, this will be 0 if i want to write a data in the slave(sensor).
    .111000-R/W ----------> 11100000
    11100000 Is E0 in hex. For this reason, I have several concerns about this module, but I hope to solve it later. Thans again for taking my doubt. I will try to send you 6 bits as data and include the CRC byte. It is likely that when I insert the writeBytes command, the R/W bit is inclued internally without me noticing.



Looks like your connection to Community was lost, please wait while we try to reconnect.