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

drivers: serial: Pico PIO UART wait for initial high #42

Conversation

petejohanson
Copy link

Adjust the PIO assemble for the UART RX to wait for the line to initially be high before starting the wrap loop and wait for a low start bit.

This comes from a report on Discord:

I've been testing the latest a bit and it is solid for me also.

The only issue I've faced is that my peripheral always receives a byte (0x00) on boot, which offsets the actual commands causing them to be corrupted.

I've copied what xudongz did with a prefix to test and now able to do bootloader and rgb across both sides.
It only happens if the peripheral is connected to central while central is powered on, so not sure if it is my board definition, the pio driver, or a hardware issue, but is not related to the PR.

@petejohanson petejohanson self-assigned this Jan 20, 2025
0x0642, /* 4: jmp x--, 2 [6] */
0x00c8, /* 5: jmp pin, 8 */
0xc014, /* 6: irq nowait 4 rel */
0x20a0, /* 7: wait 1 pin, 0 */

Choose a reason for hiding this comment

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

After adjusting jumps instruction 7 can be dropped.

Choose a reason for hiding this comment

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

		/*  .wrap_target */
	0x20a0, /*  0: wait   1 pin, 0                    */
	0x2020, /*  1: wait   0 pin, 0                    */
	0xea27, /*  2: set    x, 7                   [10] */
	0x4001, /*  3: in     pins, 1                     */
	0x0643, /*  4: jmp    x--, 3                 [6]  */
	0x00c8, /*  5: jmp    pin, 8                      */
	0xc014, /*  6: irq    nowait 4 rel                */
	0x0000, /*  7: jmp    0                           */
	0x8020, /*  8: push   block                       */
		/*  .wrap */

Adjust the PIO assemble for the UART RX to wait for the line
to initially be high before starting the wrap loop and wait
for a low start bit.

Signed-off-by: Peter Johanson <[email protected]>
@petejohanson petejohanson force-pushed the v3.5.0+zmk-fixes+pio-wait-high-on-start branch from c03e71c to 82c60e6 Compare January 20, 2025 21:29
@petejohanson petejohanson merged commit 2ab1279 into zmkfirmware:v3.5.0+zmk-fixes Jan 20, 2025
6 of 8 checks passed
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