Skip to content

ESP32-S2 doesn't work at 400 kHz: it operates at 5 kHz (reviving issue #8480) #12045

@dzalf

Description

@dzalf

Board

ESP32-S2

Device Description

Custom ESP32-S2 (based on Lolin S2 Mini Wemos

Hardware Configuration

Two ESP32-S2 boards connected by I2C

Version

latest stable Release (if not listed below)

Type

Bug

IDE Name

VSCode + pio

Operating System

Windows 11

Flash frequency

80 Mhz

PSRAM enabled

yes

Upload speed

921600

Description

Hey, guys. I come here to revive issue #8480.

I am trying to communicate two ESP32-S2 boards at 400 kHz, and it's the same story: it goes down to 5kHz

Image Image

I tried the solution from @me-no-dev , however, it doesn't do much ( too old perhaps?)

I modified these lines:

/**
 * @brief  Init I2C master
 *
 * @param  hw Beginning address of the peripheral registers
 *
 * @return None
 */
static inline void i2c_ll_master_init(i2c_dev_t *hw)
{
 typeof(hw->ctr) ctrl_reg;
    uint32_t ref_always_on = ctrl_reg.ref_always_on;
    ctrl_reg.val = 0;
    ctrl_reg.ms_mode = 1;
    ctrl_reg.sda_force_out = 1;
    ctrl_reg.scl_force_out = 1;
    ctrl_reg.ref_always_on = ref_always_on;
    hw->ctr.val = ctrl_reg.val;
}

However, the system still reverts to 5kHz

I am working with Platformio under the Espressif 32 6.12.0

Image Image

Any ideas?

Sketch

constexpr int SDA_PIN = 4; // GPIO4 for SDA
constexpr int SCL_PIN = 2; // GPIO2 for SCL

i2c_Link->setPins(SDA_PIN, SCL_PIN);
i2c_Link->begin();
    
i2c_Link->setClock(400000UL); 

}

Debug Message

I am unable to print the Core debug message with my current system. I am using USBCDC native USB

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions