rp2pio: background_write(loop=) delivers zero/partial data above ~150 MHz system clock (Metro RP2350)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
Start with the implementation of rp2pio.StateMachine.background_write() and trace how its DMA loop restarts; the issue does not name source files or tests. Reproduce the supplied loop=buf case on an RP2350 at 150 MHz and above, then verify that the GPIO output continues to match the buffer across loop restarts.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
CircuitPython version and board name
CircuitPython versions tested: 10.0.3, 10.1.3
Hardware: Adafruit Metro RP2350 (RP2350B) using A2 stepping (that can have issues)
Code/REPL
import board, rp2pio, adafruit_pioasm, microcontroller, gc, time, digitalio
microcontroller.cpu.frequency = 252_000_000
vga_program = adafruit_pioasm.assemble("""
.program vga_rgb_hsync
.side_set 1
.wrap_target
set y, 15 side 1
pixel_loop:
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
out pins, 8 side 1 [1]
jmp y-- pixel_loop side 1
nop side 1 [7]
set x, 4 side 0 [15]
hsync_loop:
nop side 0 [14]
jmp x-- hsync_loop side 0
nop side 1 [15]
nop side 1 [15]
nop side 1 [6]
.wrap
""")
# 320x525 frame buffer, all 0xFF (expected output: solid white)
buf = bytearray([0xFF] * 320 * 525)
vsync = digitalio.DigitalInOut(board.D11)
vsync.direction = digitalio.Direction.OUTPUT
vsync.value = True
sm = rp2pio.StateMachine(
vga_program,
frequency=25_175_000,
first_out_pin=board.D2,
out_pin_count=8,
first_sideset_pin=board.D10,
sideset_pin_count=1,
auto_pull=True,
pull_threshold=8,
out_shift_right=False,
)
sm.background_write(loop=buf)
time.sleep(0.1)
print(f"sm.writing: {sm.writing}") # True
# GPIO2–9 output: wrong data (see results table below)
Behavior
Expected: GPIO2–9 output matches buf contents (0xFF = solid white).
Results by version and configuration
Config A — v6 PIO: 25.175 MHz SM, out [1] (2 cycles/pixel), 252 MHz CPU:
┌─────────┬────────────┬──────────────────────────────────────────────────┐
│ Version │ sm.writing │ Screen │
├─────────┼────────────┼──────────────────────────────────────────────────┤
│ 10.0.3 │ True │ All black — zero data delivered │
├─────────┼────────────┼──────────────────────────────────────────────────┤
│ 10.1.3 │ True │ Top ~40% shows partial colour; bottom ~60% black │
└─────────┴────────────┴──────────────────────────────────────────────────┘
Config B — 252 MHz PIO: 50.4 MHz SM, out [3] (4 cycles/pixel), 252 MHz CPU
(replace frequency=25_175_000 with frequency=50_400_000 and change [1] → [3] in pixel loop):
┌─────────┬────────────┬───────────┐
│ Version │ sm.writing │ Screen │
├─────────┼────────────┼───────────┤
│ 10.0.3 │ True │ All black │
├─────────┼────────────┼───────────┤
│ 10.1.3 │ True │ All black │
└─────────┴────────────┴───────────┘
Description
StateMachine.background_write(loop=buffer) delivers incorrect pixel data at system clocks ≥ ~160 MHz. DMA reports active (sm.writing=True), HSYNC sideset runs correctly (monitor syncs), but pixel output is wrong. Behavior partially improved in 10.1.3 but is not fixed.
Tested at 200 MHz CPU to rule out other causes:
┌─────────────────────────────────────────────┬─────────────────────────────────────────────────┐
│ Test │ Result │
├─────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ sm.write(buf) in loop │ Completes at ~60 Hz — one-shot DMA works │
├─────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ initial_out_pin_state=0xFF, NOP pixel loop │ Colour visible — GPIO output and PIO clock work │
├─────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ background_write(loop=buf) with 0xFF buffer │ Sync ✓, pixel data wrong │
└─────────────────────────────────────────────┴─────────────────────────────────────────────────┘
Conclusion: The fault is specifically in background_write's DMA loop restart mechanism. One-shot DMA, GPIO output, and
PIO timing all work correctly at 200 MHz+.
Clock threshold
┌───────────┬───────────────────────────┐
│ CPU clock │ Result │
├───────────┼───────────────────────────┤
│ 150 MHz │ Correct ✓ │
├───────────┼───────────────────────────┤
│ 160 MHz │ Corrupted / sync unstable │
├───────────┼───────────────────────────┤
│ 200 MHz │ Sync ✓, wrong data │
├───────────┼───────────────────────────┤
│ 252 MHz │ Sync ✓, wrong data │
└───────────┴───────────────────────────┘
150 MHz is the rated RP2350B speed; the bug manifests at all tested overclock frequencies.
Additional information
No response
- Ngôn ngữ chính
- C
- Star
- 4.6k
- Fork
- 1.4k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 155
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của adafruit/circuitpython
-
board breaks api
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
adafruit/circuitpython#11099 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
storage usb zephyr
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
adafruit/circuitpython#11531 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Move silabs to ZephyrĐang mởsilabs
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
adafruit/circuitpython#11507 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature/API request: portable camera capture across ESP-IDF, Zephyr, and parallel interfacesCó thể đã có người làm @tannewt đã nhận hôm nay. Đang mởcircuitpython api displayio enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
adafruit/circuitpython#11505 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
adafruit/circuitpython#11472 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của adafruit/circuitpython
Issue tương tự
-
Warps 4 unit tests (raalloc)Đang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Policy query leaks host primary block (BSL_PrimaryBlock_deinit skipped) on two early-exit pathsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NASA-AMMOS/BSL#355 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
arancormonk/dsd-neo#660 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: remote-ls --updates reports up-to-date OCI refs because it ignores deployed Alt-idCó thể đã có người làm @Joao-kouznetz đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày