nrf-rs/nrf-hal

UART `write` on nrf52840 blocks

1c3t3a opened this issue · 1 comments

Hellođź‘‹ I am currently trying to use the UART connection on the nrf52840-dongle. I try to do UART over the pins 0_15 and 0_20, but I am struggling as the UART write function hangs forever on waiting till the transmission is finished. The board is set up and also has an allocator configured at the point of sending via UART. This is the loop where my program hangs:

while self.0.events_endtx.read().bits() == 0 {
// TODO: Do something here which uses less power. Like `wfi`.
}

My code for setting up the connection looks like this:

let p = pac::Peripherals::take().unwrap();

    let (uart0, cdc_pins) = {
        let p0 = gpio::p0::Parts::new(p.P0);
        (
            p.UARTE0,
            uarte::Pins {
                txd: p0.p0_15.into_push_pull_output(gpio::Level::High).degrade(),
                rxd: p0.p0_20.into_floating_input().degrade(),
                cts: Some(p0.p0_17.into_floating_input().degrade()),
                rts: Some(p0.p0_13.into_push_pull_output(gpio::Level::High).degrade()),
            },
        )
    };

    let uarte_conn = Uarte::new(
        uart0,
        cdc_pins,
        uarte::Parity::EXCLUDED,
        uarte::Baudrate::BAUD115200,
    )

I don't think that this is an issue with the library but rather with my usage of it, I just didn't really know where to ask else :)

Solved it on my own!