Skip to content
Snippets Groups Projects
Commit 062b8a34 authored by Benjamin Koch's avatar Benjamin Koch
Browse files

bugfix: enable pullup on UART RX pin

Otherwise, this would be floating when we set the RS485 transceiver
to transmit mode.
parent 06de9e12
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,16 @@ fn pin_io<P: gpio::Pin>(pin: &P) -> pac::io::Gpio {
block.gpio(pin.pin() as _)
}
fn pin_pad<P: gpio::Pin>(pin: &P) -> pac::common::Reg<pac::pads::regs::GpioCtrl, pac::common::RW> {
use gpio::Bank;
let block = match pin.bank() {
Bank::Bank0 => pac::PADS_BANK0,
Bank::Qspi => pac::PADS_QSPI,
};
block.gpio(pin.pin() as _)
}
#[allow(dead_code)]
async fn debug_print_pio_addr(sm: pac::pio::StateMachine) {
let mut prev = 42u8;
......@@ -238,6 +248,9 @@ impl<H: RS485Handler> RS485<H> {
// (PIO can always read and we don't want to write but embassy_rp cannot know that so it "helpfully" configured the pin for PIO function.)
unsafe {
pin_io(&self.rx_pin).ctrl().write(|w| w.set_funcsel(embassy_rp::pac::io::vals::Gpio17ctrlFuncsel::UART0_RX.0));
// enable pullup to have it not float when we set the transceiver to transmit
pin_pad(&self.rx_pin).modify(|w| w.set_pue(true));
}
info!("Program size for auto-baud: {}, for tx: {}, wait_for_not_idle is at: {}",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment