From 87c4eaf3380505ca15ef7ed1d5dc435e9af2200e Mon Sep 17 00:00:00 2001 From: James Munns Date: Fri, 28 Nov 2025 18:49:10 +0100 Subject: Fix LPI2C2 example (#56) Fix LPI2C2 example --- examples/src/bin/i2c-scan-blocking.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/src/bin/i2c-scan-blocking.rs b/examples/src/bin/i2c-scan-blocking.rs index 6d1247e7a..72f9d09e0 100644 --- a/examples/src/bin/i2c-scan-blocking.rs +++ b/examples/src/bin/i2c-scan-blocking.rs @@ -2,6 +2,8 @@ #![no_main] use embassy_executor::Spawner; +use embassy_mcxa::gpio::{DriveStrength, Pull, SlewRate}; +use embassy_mcxa::Input; use embassy_time::Timer; use hal::clocks::config::Div8; use hal::config::Config; @@ -19,7 +21,12 @@ async fn main(_spawner: Spawner) { let mut config = controller::Config::default(); config.speed = Speed::Standard; - let mut i2c = I2c::new_blocking(p.LPI2C3, p.P3_27, p.P3_28, config).unwrap(); + + // Note: P0_2 is connected to P1_8 on the FRDM_MCXA276 via a resistor, and + // defaults to SWO on the debug peripheral. Explicitly make it a high-z + // input. + let _pin = Input::new(p.P0_2, Pull::Disabled, DriveStrength::Normal, SlewRate::Slow); + let mut i2c = I2c::new_blocking(p.LPI2C2, p.P1_9, p.P1_8, config).unwrap(); for addr in 0x01..=0x7f { let result = i2c.blocking_write(addr, &[]); -- cgit