Skip to content

Recycling Lpuart pins #135

Closed Answered by mciantyre
isikkema asked this question in Q&A
Apr 11, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

I added NEW blocks into the troublesome example. Could you give something like this a try?

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-iom…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@isikkema
Comment options

@isikkema
Comment options

@mciantyre
Comment options

Answer selected by isikkema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants