Skip to content

nrf51 uart write blocks in qemu #426

@JoshMcguigan

Description

@JoshMcguigan

Hello! I am following along the rust discovery uart example by running the microbit v1 (nrf51) in qemu.

$ cargo build --features v1 --target thumbv6m-none-eabi

$ qemu-system-arm -machine microbit -display none -serial stdio -s -kernel target/thumbv6m-none-eabi/debug/uart

At first I thought the qemu emulation might be at fault, but I found this forum post where they seem to see a similar problem on real hardware with code that matches the uart write impl here:

fn write(&mut self, byte: u8) -> nb::Result<(), Self::Error> {
// Are we ready for sending out next byte?
if self.0.events_txdrdy.read().bits() == 1 {
// Reset ready for transmit event.
self.0.events_txdrdy.reset();
// Send byte.
self.0.txd.write(|w| unsafe { w.bits(u32::from(byte)) });

This check for txdrdy hangs when trying to send the first byte. The reference manual says the txdrdy event is triggered only when a byte is actually sent. That aligns with the findings in the forum post that show very similar code blocking indefinitely.

Unfortunately I don't have real hardware to test this on at the moment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions