WiPy 2.0 + Expansion Board 2.1A I²C & Button



  • Hi to everyone,

    I'm using a WiPy 2.0 with the Expansion Board v2.1A. Due to the datasheets the Pin 9 and Pin 10 are used for I²C communication. On the other hand Pin 10 is also used for the user button of the Expansion Board.

    So can I use I²C devices and the button at the same time?

    Thanks a lot!



  • @robert-hh A usage of the I2C hardware implementation was just a guess because I2C with the 8266 was such a mess. I wanted to use a MPU9250 and checked the clock bus using an TDS2024B oscilloscope. Every pulse of the clock signal was a mess (and different from each other!) so I thought that the WiPy with the ESP32 uses the hardware implementation because it worked out of the box.

    @jmarcelino Thank you for clearing things up!



  • I2C is implemented in pycom-micropython-sigfox/esp32/mods/machine_i2c.c
    and we can see it still doesn't use the I2C hardware on the ESP32. It's software based.

    However even when it's implemented in hardware you should be able to map I2C to any of the GPIO pins (except to the pins marked "Input only" in the data sheet) because the ESP32 has an internal GPIO Multiplexer.



  • @Immondizia I've read somewhere that Pycom still uses a software implementation and not the I2C hardware. That sounds confusing.
    I have used I2C on the ESP8266 without problems, only the specified baud rate is never met. At a specified rate of 400000 I've seen 130000 @ 80Mhz clock and about twice that rate at 160 MHz clock. But that did not matter for my application.

    I just made a quick check on a LoPy, and a baud rate setting of 400000 results in a baud rate of 324700, at any chosen port. Other values:
    200000 -> 195300
    100000 -> 88500



  • @Immondizia
    I do not know if I2C is already hardware at all
    i do not see that @daniel write something abut hardware implementation finished



  • @robert-hh If I use other pins for I²C is the communication then software emulated? I had a lot of trouble driving sensors using I²C with the ESP8266 because of the Real-time requirements. As a result I received a totally broken clock signal so that I was forced to use SPI.



  • @Immondizia You can use other I/O capable pins for I2C, like for instance:

    >>> from machine import I2C, Pin
    >>> i2c=I2C(0, I2C.MASTER, pins=(Pin('P7'), Pin('P8')), baudrate=100000)
    >>> i2c.scan()
    


Pycom on Twitter