I2C repeated start



  • Is I2C using repeated start by default?

    I am having trouble to communicate with Lidar Lite v3, issues are similar to this post (Lidar+RPi): http://www.robotshop.com/forum/lidar-lite-v3-return-always-zero-with-raspberry-pi-3-t15710

    In the Lidar Lite v3 datasheet it is written:
    This device does not work with repeated START conditions. It must first receive a STOP condition before a new START condition.

    I tried both hardware (0 and 1) and software (2) I2C buses. Lidar's address is returned correctly with machine.I2C.scan().



  • @daniel
    Yes, I used readfrom_mem() and writeto_mem().

    Thanks a lot for your solution proposal, this approach works for me well :)


  • administrators

    @danielm is that happening when you try to do readfrom_mem() and writeto_mem()? Solution is then to assemble the memory operations manually using writeto (set the stop argument to True) and readfrom. A generic example:

    reg[0] = 117 # register address
    i2c.writeto(addr, reg, stop=True) # just write the register address
    # now read
    i2c.readfrom_into(addr, reg)
    

Log in to reply
 

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