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

    [CoreS3] I2C doesn't work...

    Arduino
    3
    4
    2.6k
    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.
    • AmedeeA
      Amedee
      last edited by

      Hi!

      I can't get I2C working properly with my CoreS3...

      Environment:

      • CoreS3
      • ENV-III sensor on Port A or Port B (no difference)
      • Arduino IDE 2.2.1 with M5CoreS3 0.0.4
      • Same with PlatformIO Core 6.1.11 with M5CoreS3 0.0.4

      The issue is really weird:

      1. Connect a sensor on Port A or B
      2. Flash the "CoreS3 UserDemo" with M5Burner. Sensor can be seen in the I2C menu
      3. Flash a program using I2C (E.g. the I2C_Tester.ino from the sample folder)
      4. So far so good, it all works, we can get data from the SHT30 and the QMP6988 without any issue. Works on Port A and Port B.
      5. Power off the device completely (Battery off, USB cable disconnected), the re-connect.
      6. I2C doesn't work anymore (behavior is slightly different with the port: Port A times out and Port B just doesn't see any sensor, but none work)
      7. The only way to get I2C back is to re-flash "CoreS3 UserDemo"

      I2C does work as expected with UiFlow, so I assume the CoreS3 and the ENV-III aren't faulty.
      I would think that I2C isn't properly initialized at startup...

      The PIO console sometimes shows memory allocation error during startup (before setup() is invoked)

      0:40:11.059 > ESP-ROM:esp32s3-20210327
      20:40:11.059 > Build:Mar 27 2021
      20:40:11.060 > rst:0xc (RTC_SW_CPU_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
      20:40:11.060 > Saved PC:0x40377900
      20:40:11.062 > SPIWP:0xee
      20:40:11.062 > mode:DIO, clock div:1
      20:40:11.064 > load:0x3fce3808,len:0x44c
      20:40:11.066 > load:0x403c9700,len:0xbe4
      20:40:11.068 > load:0x403cc700,len:0x2a68
      20:40:11.090 > entry 0x403c98d4
      20:40:11.245 > [   186][E][Wire.cpp:152] allocateWireBuffer(): Can't allocate memory for I2C_0 rxBuffer
      20:40:11.247 > [   187][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=2 scl=1 freq=100000
      20:40:12.143 > [  1084][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
      20:40:12.160 > Initialize M5
      20:40:13.660 > M5CoreS3 initializing...OK
      
      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by

        Hello @Amedee

        on M5CoreS3 the 5 V on the Groove ports needs to be enabled explicitly. See section Power Management here.

        Try calling below function in setup():

        M5.Axp.powerModeSet(POWER_MODE_USB_IN_BUS_OUT);
        

        Thanks
        Felix

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

        ajb2k3A AmedeeA 2 Replies Last reply Reply Quote 1
        • ajb2k3A
          ajb2k3 @felmue
          last edited by

          @felmue there is also a king running issue with the ENV III unit

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          1 Reply Last reply Reply Quote 0
          • AmedeeA
            Amedee @felmue
            last edited by

            @felmue That was the problem

            Thank you very much!

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