aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/rp/src/bin/pio_uart.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/rp/src/bin/pio_uart.rs b/examples/rp/src/bin/pio_uart.rs
index 5fddbe292..4c382c2ee 100644
--- a/examples/rp/src/bin/pio_uart.rs
+++ b/examples/rp/src/bin/pio_uart.rs
@@ -338,7 +338,7 @@ mod uart_rx {
338 start: 338 start:
339 wait 0 pin 0 ; Stall until start bit is asserted 339 wait 0 pin 0 ; Stall until start bit is asserted
340 set x, 7 [10] ; Preload bit counter, then delay until halfway through 340 set x, 7 [10] ; Preload bit counter, then delay until halfway through
341 rx_bitloop: ; the first data bit (12 cycles incl wait, set). 341 rx_bitloop: ; the first data bit (12 cycles incl wait, set).
342 in pins, 1 ; Shift data bit into ISR 342 in pins, 1 ; Shift data bit into ISR
343 jmp x-- rx_bitloop [6] ; Loop 8 times, each loop iteration is 8 cycles 343 jmp x-- rx_bitloop [6] ; Loop 8 times, each loop iteration is 8 cycles
344 jmp pin good_rx_stop ; Check stop bit (should be high) 344 jmp pin good_rx_stop ; Check stop bit (should be high)
@@ -347,7 +347,8 @@ mod uart_rx {
347 wait 1 pin 0 ; and wait for line to return to idle state. 347 wait 1 pin 0 ; and wait for line to return to idle state.
348 jmp start ; Don't push data if we didn't see good framing. 348 jmp start ; Don't push data if we didn't see good framing.
349 349
350 good_rx_stop: ; No delay before returning to start; a little slack is 350 good_rx_stop: ; No delay before returning to start; a little slack is
351 in null 24
351 push ; important in case the TX clock is slightly too fast. 352 push ; important in case the TX clock is slightly too fast.
352 "# 353 "#
353 ); 354 );
@@ -361,8 +362,9 @@ mod uart_rx {
361 sm_rx.set_pin_dirs(Direction::In, &[&rx_pin]); 362 sm_rx.set_pin_dirs(Direction::In, &[&rx_pin]);
362 363
363 cfg.clock_divider = (U56F8!(125_000_000) / (8 * baud)).to_fixed(); 364 cfg.clock_divider = (U56F8!(125_000_000) / (8 * baud)).to_fixed();
364 cfg.shift_out.auto_fill = false; 365 cfg.shift_in.auto_fill = false;
365 cfg.shift_out.direction = ShiftDirection::Right; 366 cfg.shift_in.direction = ShiftDirection::Right;
367 cfg.shift_in.threshold = 32;
366 cfg.fifo_join = FifoJoin::RxOnly; 368 cfg.fifo_join = FifoJoin::RxOnly;
367 sm_rx.set_config(&cfg); 369 sm_rx.set_config(&cfg);
368 sm_rx.set_enable(true); 370 sm_rx.set_enable(true);