🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Stamp C3 - I2C interface

    Modules
    4
    6
    10.3k
    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.
    • D
      didier9
      last edited by

      Does the M5Stamp C3 have an I2C interface? I do not see any reference to it on the pinout.

      www.ko4bb.com

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by

        Hello @didier9

        according to its datasheet any GPIO can be used for I2C.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 0
        • D
          didier9
          last edited by

          Thank you, that is good news.
          Now I just have to find out how to configure and access it from the Arduino IDE :)

          www.ko4bb.com

          M 1 Reply Last reply Reply Quote 0
          • M
            mlindholm @didier9
            last edited by

            @didier9 said in M5Stamp C3 - I2C interface:

            Now I just have to find out how to configure and access it from the Arduino IDE :)

            Good luck! I've had a dilly of a time trying to consistently get something (useful!) loaded to the device. Generic Micropython for ESP32 doesn't work, the generic Micropython builds for the ESP32-C3 don't work, not does building the package from scratch and loading it. I thought perhaps it was faulty, but I did get the below sketch to load and run, giving me functional serial output...so I know it's not dead, but I'm glad I bought multiple devices.

            Examples for STAMP-C3 -> ESP32 -> ChipID -> GetChipID

            FYI, on the STAMP-PICO, I used the below in Arduino to run I2C on the Grove port, to talk with an adapter cable to Adafruit StemmaQT sensors. Obviously it doesn't DO anything, but it's what was required to use specific pins for I2C.

            #include <Wire.h>
            // Declare alternate I2C pins
            #define I2C_SDA 32
            #define I2C_SCL 33
            void setup(void) {

            // Initialize I2C using alternate pins

            I2CMS.begin(I2C_SDA, I2C_SCL, 400000);
            }

            D 1 Reply Last reply Reply Quote 0
            • D
              davidgs @mlindholm
              last edited by

              @mlindholm I appreciate your posting this, but I'm unable to make it work. First off:

              I2CMS.begin() is not actually a thing? Unless you're importing I2CMS from somewhere I'm not aware of?

              I've tried with

              #define I2C_SDA 8 // pin 8
              #define I2C_SCL 7 // pin 7
              
              setup(){
                Wire.begin(I2C_SDA, I2C_SCL);
              }
              

              But I'm still unable to read from the I2C device. I've got other stuff working on the board (like a fan-control, and a water pump) but I2C and Servos are steadfastly refusing to function.

              Ideas?

              dg

              1 Reply Last reply Reply Quote 0
              • felmueF
                felmue
                last edited by felmue

                Hello @davidgs

                Hmm, I can scan the I2C bus just fine using port A (GPIO0 and GPIO1):

                Wire.begin(GPIO_NUM_1, GPIO_NUM_0);
                

                I2C requires pull-up resistors on both lines. GPIO8 already has a 10k pull-up resistor. Did you add a pull-up resistor to GPIO7 as well? Some I2C slave devices might already have pull-up resistors in place tough.

                Edit: I've just tried with GPIO7 and GPIO8. The I2C scan works with those two GPIOs for me as well.

                Thanks
                Felix

                GPIO translation table M5Stack / M5Core2
                Information about various M5Stack products.
                Code examples

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post