Issue with I2C... or is it me?

  • Greetings,

    I have been working with the LoPy4 and the MCP23017 IO Expander. I also have a Saleae Logic 4 that I have hooked up to see the protocol in action. I notice something strange though.

    I initialize using the following:

    from machine import I2C
    i2c = I2C(0, I2C.MASTER) 
    i2c.writeto_mem(0x20, 0x00, 0xFF)

    The address set on the MCP23017 should be 0x20 as I have the A0 ... A2 pins all biased to ground. But in the Saleae Logic UI it's showing me that instead of writing to the slave at 0x20 it is instead 0x40.

    Screen Shot 2019-06-23 at 11.20.29 PM.png

    What do you think is causing this?

  • @CoachAllen As I learned from this site - it is because of the last bit (0 for reading and 1 for writing). I recommend to find that post - just search for "i2c address" or similar... To confirm that post conclusion I ran i2c.scan() and it gave me the slave address [66], meaning 0x42 and that's what I used for reading...

  • @CoachAllen What Pycom driver you are using for the MCP23017?

  • Okay I figured out it's me.

    In the settings for the Saleae Logic software I had it set to 8 bit addressing not 7 bit. Duh...

Log in to reply

Pycom on Twitter