You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use esp_idf_svc::hal::{delay::FreeRtos, i2c::*, prelude::*};fnmain(){
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());letmut i2c = I2cDriver::new(i2c, sda, scl,&config).unwrap();for addr in110..=127{//adjusted because I know the device address is 118println!("Scanning Address {}", addr asu8);// Scan Addresslet res = i2c.read(addr asu8,&mut[0],10);// Check and Print Resultmatch res {Ok(_) => println!("Device Found at Address {}", addr asu8),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.
The text was updated successfully, but these errors were encountered:
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.
Hi,
i have the following test code:
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.
The text was updated successfully, but these errors were encountered: