Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

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

    Scheduled Pinned Locked Moved WiPy 2&3
    expansionboardwipy2.0i2c
    7 Posts 4 Posters 2.8k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I Offline
      Immondizia
      last edited by

      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-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @Immondizia
        last edited by robert-hh

        @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()
        
        I 1 Reply Last reply Reply Quote 1
        • I Offline
          Immondizia @robert-hh
          last edited by

          @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.

          L robert-hhR 2 Replies Last reply Reply Quote 0
          • L Offline
            livius @Immondizia
            last edited by

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

            think about people first, then computers

            1 Reply Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh @Immondizia
              last edited by robert-hh

              @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

              I 1 Reply Last reply Reply Quote 0
              • J Offline
                jmarcelino
                last edited by jmarcelino

                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.

                1 Reply Last reply Reply Quote 0
                • I Offline
                  Immondizia @robert-hh
                  last edited by Immondizia

                  @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!

                  1 Reply Last reply Reply Quote 0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • 1 / 1
                  • First post
                    Last post

                  Pycom on Twitter

                  Pycom