pico_usb-cdc example fails with panic
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
- 22/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
The gdb backtrace points to the assert in ep_writev in port/raspberrypi/rp2xxx/src/hal/usb.zig (around line 287), reached from on_setup_req in core/src/core/usb.zig (line 482) and the poll loop in examples/raspberrypi/rp2xxx/src/usb_cdc.zig (line 76). Start by reading why the endpoint 0 write assertion fails during setup handling, then check the device descriptor response. Done means the pico_usb-cdc example enumerates on hardware without a HardFault.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I built the rp2xxx examples with zig 0.15.1 on a Linux (Mint) system and uploaded the pico_usb-cdc example to a Raspberry Pi Pico with the command:
openocd -f interface/cmsis-dap.cfg \
-f target/rp2040.cfg \
-c "adapter speed 5000" \
-c "program zig-out/firmware/pico_usb-cdc.elf verify reset exit"
The serial port output shows the "STARTING NEW LOGGER" banner, then nothing. The device does not show up when using the lsusb command on the Raspberry Pi 5 to which the Pico's USB port is connected and nothing appears in the Pi's logs.
If I unplug the Pico from the USB Port and plug it back in, the serial port log shows:
================ STARTING NEW LOGGER ================
[5.355586] error: panic: reached unreachable code
[5.361085] error: panic: Unhandled exception: HardFault
Looking at the log on the Raspberry Pi I see that it did recognise that something was connected:
Apr 05 08:25:17 hal kernel: usb 3-2: new full-speed USB device number 123 using xhci-hcd
Apr 05 08:25:32 hal kernel: usb 3-2: device descriptor read/64, error -110
Apr 05 08:25:48 hal kernel: usb 3-2: device descriptor read/64, error -110
Apr 05 08:25:48 hal kernel: usb 3-2: new full-speed USB device number 124 using xhci-hcd
Apr 05 08:26:03 hal kernel: usb 3-2: device descriptor read/64, error -110
Note that after the panic happens before the second of these log lines is printed so the read error is unsurprising.
I ran the program again omitting the "exit" from the openocd command. Then after unplugging and plugging in the USB I connected to the Pico with gdb. The stack trace shows:
(gdb) bt
#0 usb_cdc.panic (message=...) at /home/craig/Git_Projects/microzig/examples/raspberrypi/rp2xxx/src/usb_cdc.zig:37
#1 0x100002e0 in builtin.panic__struct_2051.panic (msg=..., ra=...) at /home/craig/.zvm/0.15.1/lib/std/builtin.zig:1091
#2 0x10000ce0 in debug.FullPanic((function 'panic')).reachedUnreachable () at /home/craig/.zvm/0.15.1/lib/std/debug.zig:64
#3 0x10000308 in debug.assert (ok=false) at /home/craig/.zvm/0.15.1/lib/std/debug.zig:559
#4 0x1000fa04 in hal.usb.Polled(.{ .max_endpoints_count = 16, .max_interfaces_count = 16, .sync_noops = 3 }).ep_writev (itf=0x20000120 <usb_cdc.usb_device+264>, ep_num=ep0, data=...)
at /home/craig/Git_Projects/microzig/port/raspberrypi/rp2xxx/src/hal/usb.zig:287
#5 0x10009f52 in core.usb.DeviceInterface.ep_writev (self=0x20000120 <usb_cdc.usb_device+264>, ep_num=ep0, data=...) at /home/craig/Git_Projects/microzig/core/src/core/usb.zig:128
#6 0x100060ee in core.usb.DeviceController(.{ .bcd_usb = .{ ... }, .device_triple = .{ ... }, .vendor = .{ ... }, .product = .{ ... }, .bcd_device = .{ ... }, .language = .English, .serial = &.{ ... }[0..(...)], .max_supported_packet_size = 64, .configurations = &.{ ... }[0..(...)], .unique_endpoints = true },.{ .{ ... } }).on_setup_req (self=0x20000124 <usb_cdc.usb_controller>,
device_itf=0x20000120 <usb_cdc.usb_device+264>, setup=0x2003f9d0) at /home/craig/Git_Projects/microzig/core/src/core/usb.zig:482
#7 0x1000491a in hal.usb.Polled(.{ .max_endpoints_count = 16, .max_interfaces_count = 16, .sync_noops = 3 }).poll__anon_16389 (self=0x20000018 <usb_cdc.usb_device>,
controller=0x20000124 <usb_cdc.usb_controller>) at /home/craig/Git_Projects/microzig/port/raspberrypi/rp2xxx/src/hal/usb.zig:131
#8 0x10003f04 in usb_cdc.main () at /home/craig/Git_Projects/microzig/examples/raspberrypi/rp2xxx/src/usb_cdc.zig:76
#9 0x1000598a in start.microzig_main () at start.zig:62
#10 0x1000f15e in cortex_m.startup_logic._start () at /home/craig/Git_Projects/microzig/core/src/cpus/cortex_m.zig:761
Running uname on the Pi:
Linux hal 6.12.75+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.75-1+rpt1 (2026-03-11) aarch64 GNU/Linux
- Ngôn ngữ chính
- Zig
- Star
- 2.3k
- Fork
- 198
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 37
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 ZigEmbeddedGroup/microzig
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ZigEmbeddedGroup/microzig#1086 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 69/100
ZigEmbeddedGroup/microzig#1085 ·
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 65/100
ZigEmbeddedGroup/microzig#1061 ·
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 65/100
ZigEmbeddedGroup/microzig#1059 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
regz: AVR peripherals generated at address 0 when the register-group name matches the module (ATDF)Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
ZigEmbeddedGroup/microzig#1072 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ZigEmbeddedGroup/microzig
Issue tương tự
-
[BUG] OTA Requestor accepts reserved provider endpoint 0xFFFFCó thể đã có người làm @Chapoly1305 đã 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
project-chip/connectedhomeip#74742 ·
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 63/100
Xinyuan-LilyGO/T-Display-S3#352 · 3 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
lsongdev/node-bluetooth#62 ·
-
docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
adidshaft/grok-gadgets#202 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
api-v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
adafruit/Adafruit_Wippersnapper_Arduino#1012 ·
Maintainer thường phản hồi trong vòng 5 ngày