Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf51 uart write blocks in qemu #426

Open
JoshMcguigan opened this issue Sep 4, 2023 · 0 comments
Open

nrf51 uart write blocks in qemu #426

JoshMcguigan opened this issue Sep 4, 2023 · 0 comments

Comments

@JoshMcguigan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant