Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c broken on esp32-c6 #380

Closed
Zercerium opened this issue Feb 14, 2024 · 1 comment
Closed

i2c broken on esp32-c6 #380

Zercerium opened this issue Feb 14, 2024 · 1 comment

Comments

@Zercerium
Copy link

Hi,

i have the following test code:

use esp_idf_svc::hal::{delay::FreeRtos, i2c::*, prelude::*};

fn main() {
    esp_idf_svc::sys::link_patches();
    esp_idf_svc::log::EspLogger::initialize_default();
    log::info!("Hello, world!");
    let peripherals = Peripherals::take().unwrap();
    let i2c = peripherals.i2c0;
    let sda = peripherals.pins.gpio23;
    let scl = peripherals.pins.gpio22;
    let config = I2cConfig::new().baudrate(100.kHz().into());
    let mut i2c = I2cDriver::new(i2c, sda, scl, &config).unwrap();

    for addr in 110..=127 { //adjusted because I know the device address is 118
        println!("Scanning Address {}", addr as u8);
        // Scan Address
        let res = i2c.read(addr as u8, &mut [0], 10);
        // Check and Print Result
        match res {
            Ok(_) => println!("Device Found at Address {}", addr as u8),
            Err(_) => println!("No Device Found"),
        }
    }
    FreeRtos::delay_ms(10000);
}

the project was generated with cargo generate esp-rs/esp-idf-template cargo

on an esp32 the codes works as expected and shows me the address. The same code executed with an esp32-c6 shows sadly nothing (generated separate project for every chip). Any Idea what I could try? I really do not know what to do now after lots of testing and finally dig up an esp32 for testing.

@Zercerium
Copy link
Author

Zercerium commented Feb 15, 2024

Ok, I overlooked a pinout definition and found LP-I2C-SDA and SCL on pin 6 and 7.
Configured with this it now detects the I2C devices.
Sry for the noise.
On my other boards SDA/SCL was every time mentioned on the board itself behind the PIN number. No SDA/SC: reference on this board. Thought it was freely configurable cause no reference on the board and the method allowed 2 random pins.

Edit: Now with esp-idf v5.2 it seems to be more stable in some first tests. Before it was detected once and then never again.

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant