-
For reasons I can't explain, I'm trying to use a pin for I've tried this: let mut lpuart2: board::Lpuart2 = board::lpuart(lpuart2, pins.p14, pins.p15, UART_BAUD);
/*
use lpuart2...
*/
// Pull pins out of Lpuart
lpuart2.reset();
let (_, lpuart::Pins { tx: p14, .. }) = lpuart2.release();
let mut analog_input = AnalogInput::new(p14);
log::info!("Pin 14 ADC: {}", adc1.read_blocking(&mut analog_input)); // Always reads a HIGH value (1022) This compiles, but it only reads high values like 1022 from now on. If I never use it for // let mut lpuart2: board::Lpuart2 = board::lpuart(lpuart2, pins.p14, pins.p15, UART_BAUD);
/*
use lpuart2...
*/
// Pull pins out of Lpuart
// lpuart2.reset();
// let (_, lpuart::Pins { tx: p14, .. }) = lpuart2.release();
let p14 = pins.p14;
let mut analog_input = AnalogInput::new(p14);
log::info!("Pin 14 ADC: {}", adc1.read_blocking(&mut analog_input)); // Reads the expected value Is there a way to reset the pin to its pre-lpuart state? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I added let mut lpuart2: board::Lpuart2 = board::lpuart(lpuart2, pins.p14, pins.p15, UART_BAUD);
/*
use lpuart2...
*/
// Pull pins out of Lpuart
lpuart2.reset();
//
// NEW: make p14 mut.
//
let (_, lpuart::Pins { tx: mut p14, .. }) = lpuart2.release();
//
// NEW: set the pin back to its GPIO alternate.
//
use teensy4_bsp::hal::iomuxc;
iomuxc::alternate(&mut p.p14, 5);
let mut analog_input = AnalogInput::new(p14);
log::info!("Pin 14 ADC: {}", adc1.read_blocking(&mut analog_input)); // Always reads a HIGH value (1022) From what I can see in the code, there may be a missing configuration down in imxrt-iomuxc. The If this works, we'll fix imxrt-iomuxc so that we won't need these |
Beta Was this translation helpful? Give feedback.
I added
NEW
blocks into the troublesome example. Could you give something like this a try?From what I can see in the code, there may be a missing configuration down in imxrt-iom…