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

    Core S3 I2C Issue: SCL is held low on the bus

    General
    2
    3
    37
    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.
    • T
      terpasaurus
      last edited by

      Hi, I'm new to M5Stack. I have a Core S3, Unit CO2L, PaHub, and Unit LIGHT.

      Last week, I had a working setup for this in ESPHome. For some reason now, when I start the device it's unable to communicate over the Port A I2C bus assigned to GPIO pins 1 and 2. Whether I have the PaHub or the CO2L plugged directly into Port A, I get the following error about "SCL is held low on the bus."

      [07:19:11][C][i2c.idf:083]: I2C Bus:
      [07:19:11][C][i2c.idf:084]:   SDA Pin: GPIO2
      [07:19:11][C][i2c.idf:084]:   SCL Pin: GPIO1
      [07:19:11][C][i2c.idf:084]:   Frequency: 50000 Hz
      [07:19:11][C][i2c.idf:097]:   Recovery: failed, SCL is held low on the bus
      [07:19:11][I][i2c.idf:104]: Results from bus scan:
      [07:19:11][I][i2c.idf:106]: Found no devices
      [07:19:11][C][i2c.idf:083]: I2C Bus:
      [07:19:11][C][i2c.idf:084]:   SDA Pin: GPIO12
      [07:19:11][C][i2c.idf:084]:   SCL Pin: GPIO11
      [07:19:11][C][i2c.idf:084]:   Frequency: 50000 Hz
      [07:19:11][C][i2c.idf:094]:   Recovery: bus successfully recovered
      [07:19:11][I][i2c.idf:104]: Results from bus scan:
      [07:19:11][I][i2c.idf:110]: Found device at address 0x34
      [07:19:11][I][i2c.idf:110]: Found device at address 0x40
      [07:19:11][I][i2c.idf:110]: Found device at address 0x51
      [07:19:11][I][i2c.idf:110]: Found device at address 0x58
      [07:19:11][I][i2c.idf:110]: Found device at address 0x69
      

      You can see here, I had two I2C bus configured, the internal sub on GPIO 11 and 12, and the external bus on GPIO 1 and 2:

      i2c:
        - id: i2c_port_a
          sda: GPIO2
          scl: GPIO1
          scan: true
        - id: i2c_internal
          sda: GPIO12
          scl: GPIO11
          scan: true
      
      sensor:
        - platform: scd4x
          i2c_id: i2c_port_a
          id: scd41_sensor
          automatic_self_calibration: false
          co2:
            name: "CO2"
            id: co2_sensor
            unit_of_measurement: "ppm"
            accuracy_decimals: 0
          temperature:
            name: "Temperature"
            id: temperature_sensor
            unit_of_measurement: "°C"
            accuracy_decimals: 1
          humidity:
            name: "Humidity"
            id: humidity_sensor
            unit_of_measurement: "%"
            accuracy_decimals: 1
          update_interval: 5s
      

      I had a more complex configuration, but I have removed it down to the bare essentials after this issue began. I haven't done any soldering or even opened the device. Everything I find about this error has related to physical hardware issues folks typically caused while integrating custom hardware. But I haven't done anything like this.

      I have tried plugging in the PaHub and the CO2L and in both cases I see this issue. I have tried power cycling the device, etc.

      1 Reply Last reply Reply Quote 0
      • T
        terpasaurus
        last edited by

        For the person who finds this later from a web search, I figured out an explanation. By default, the pins for the external I2C bus (GPIO1 and GPIO2) are not put into a usable power state. As the error message above states, the SDA pin has a low power signal being held which prevents other things from using this bus to communicate.

        The simplest way for me to ensure the pins (and other things) are initialized is to import the m5stack/M5Unified library from PlatformIO, and the external component board_m5cores3 from https://github.com/m5stack/M5CoreS3-Esphome, then declare board_m5cores3: in the ESPHome YAML config:

        esphome:
          name: ${hostname}
          friendly_name: ${friendlyname}
          platformio_options:
            board_build.flash_mode: dio
            board_build.mcu: esp32s3
            board_build.f_cpu: 240000000L
          libraries:
            - m5stack/M5Unified
        
        external_components:
          - source:
              type: git
              url: https://github.com/m5stack/M5CoreS3-Esphome
            refresh: 0s
            components: [board_m5cores3]
        
        board_m5cores3:
        

        This results in M5.begin() being called. The M5 namespace on which it's calling begin() is provided by the m5stack/M5Unified C++ library. This ensures physical buttons and hardware are initialized properly for this particular board.

        The begin method is defined here. On L349-343:

        auto board = _check_boardtype(Display.getBoard());
        if (board == board_t::board_unknown) { board = cfg.fallback_board; }
        _board = board;
        _setup_pinmap(board);
        _setup_i2c(board);
        

        That call _setup_i2c is calling this and this from deeper within the M5Unified's I2C library. That seems to cause SDA to not be held in LOW state.

        1 Reply Last reply Reply Quote 0
        • H
          hacxx
          last edited by

          It sounds like the SCL line on GPIO1 is stuck low, causing the bus to hang. Since your internal I2C on GPIO11/12 works fine, this suggests a hardware issue on Port A or interference on those pins. Double-check for any accidental shorts, damaged cables, or faulty devices connected to Port A. Also, try disconnecting all devices from Port A and test again. If the problem persists, it might be a hardware fault on the Core S3 board’s GPIO1 pin. Consider testing with a different device or contacting M5Stack support for hardware diagnostics.

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