[CoreS3] I2C doesn't work...



  • 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
    


  • 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



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



  • @felmue That was the problem

    Thank you very much!