ws2812: gaps between bytes on AVR latch the strip after the first LED
Maintainer thường phản hồi trong vòng 3 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
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- arduino, go
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
Start with ws2812_avr.go and trace WriteByte, PortMaskSet, PortMaskClear, and writeColorsRGB to understand the AVR timing between bytes. Build the supplied reproducer for -target=arduino and compare its output with the working continuous-buffer bit loop described in the issue. Done means all 40 LEDs update correctly on the Uno without the byte gaps triggering a latch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
On an Arduino Uno (ATmega328P, 16 MHz) with an Adafruit NeoPixel Shield (40 WS2812B LEDs on D6), WriteColors lights only the first LED, which flickers. The rest stay dark. The same shield works on a 48 MHz SAMD21 board.
The AVR WriteByte in ws2812_avr.go sends each byte from inline assembly, and the bit timing inside a byte is correct. Between bytes, the line stays low while Go code runs: the WriteByte call and return, the pin mask calculation in PortMaskSet and PortMaskClear, interrupt.Disable and Restore, and the loop and applyBrightness in writeColorsRGB. In the compiled example that comes to about 130 cycles (~8 µs) between bytes, and more between pixels. That's longer than the WS2812B latch time, so the strip latches after each byte and the next byte is written to the first LED again.
Results with the same Uno, shield and pin:
| Sender | Gap between bytes | Result |
|---|---|---|
ws2812.WriteColors (drivers v0.36.0) |
~8 µs | first LED flickers, the rest stay dark |
The driver's bit loop inside an outer loop over the whole buffer (ld X+) |
~0.4 µs | all 40 LEDs correct |
This is separate from #923. Nothing interrupts the write here, so keeping interrupts disabled for the whole frame does not help.
To reproduce, build this program for -target=arduino:
package main
import (
"image/color"
"machine"
"time"
"tinygo.org/x/drivers/ws2812"
)
func main() {
pin := machine.D6
pin.Configure(machine.PinConfig{Mode: machine.PinOutput})
strip := ws2812.NewWS2812(pin)
strip.SetBrightness(16)
var pixels [40]color.RGBA
for step := uint8(0); ; step++ {
for i := range pixels {
pixels[i] = color.RGBA{R: uint8(i*6) + step, G: 64, B: 255 - uint8(i*6), A: 255}
}
strip.WriteColors(pixels[:])
time.Sleep(20 * time.Millisecond)
}
}
- Ngôn ngữ chính
- Go
- Star
- 756
- Fork
- 251
- Merge trung bình
- 7 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 tinygo-org/drivers
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
tinygo-org/drivers#946 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 22/100
tinygo-org/drivers#901 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
tinygo-org/drivers#886 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
tinygo-org/drivers#877 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
240Mhz Support For ESP32-S3Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
tinygo-org/drivers#876 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của tinygo-org/drivers
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sresarehumantoo/cc-artex#456 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ollama/ollama#20021 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
factory:subtask
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
release
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
github/gh-aw-mcpg#17603 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
avr: SPI Mode2 runs as mode 1Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
tinygo-org/tinygo#6727 ·
Maintainer thường phản hồi trong vòng 1 ngày