Skip to content

Fix UART on rp2xxx - #993

Merged
mattnite merged 1 commit into
ZigEmbeddedGroup:mainfrom
pcolladosoto:main
Jul 23, 2026
Merged

Fix UART on rp2xxx#993
mattnite merged 1 commit into
ZigEmbeddedGroup:mainfrom
pcolladosoto:main

Conversation

@pcolladosoto

Copy link
Copy Markdown
Contributor

When trying to run some of the examples at examples/raspberrypi/rp2xxx/src/usb_cdc.zig I noticed data was written into the UART in an infinite loop. After looking into it it seems data being primed into the UART TX FIFO is not being taken into account when accumulating the amount of bytes written. This (I believe) throws std.Io.Writer.writeAll into an infinite loop.

This PR simply increments written by whatever amount of data is primed into the TX FIFO. At least on my Pico (i.e. RP20240) this makes the UART functional again.

BTW, thanks a million for making microzig :P

Data primed into the UART TX FIFO must be tracked not only for
indexing the remaining data, but also for returning the amount
of written bytes so that `writeAll` can terminate.

@mattnite mattnite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the catch! I definitely missed that while doing the 0.17 upgrade.

@mattnite
mattnite merged commit 47c3de6 into ZigEmbeddedGroup:main Jul 23, 2026
1 check failed
@pcolladosoto

Copy link
Copy Markdown
Contributor Author

Thank you for putting microzig together! Have a great day :)

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

Successfully merging this pull request may close these issues.

2 participants