ws2812: gaps between bytes on AVR latch the strip after the first LED
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- arduino, go
- Área
- embedded-iot
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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)
}
}
- Lenguaje dominante
- Go
- Estrellas
- 756
- Forks
- 251
- Merge medio
- 7 d 12 h
- PR fusionados (30 d)
- 8
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tinygo-org/drivers
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
tinygo-org/drivers#946 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 22/100
tinygo-org/drivers#901 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
tinygo-org/drivers#886 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
tinygo-org/drivers#877 ·
Los mantenedores suelen responder en 3 días
-
240Mhz Support For ESP32-S3Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
tinygo-org/drivers#876 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
Todos los issues de tinygo-org/drivers
Issues similares
-
release
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
github/gh-aw-mcpg#17603 ·
Los mantenedores suelen responder en 1 día
-
avr: SPI Mode2 runs as mode 1Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
tinygo-org/tinygo#6727 ·
Los mantenedores suelen responder en 1 día
-
help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 94/100
oras-project/oras-go#1827 ·
Los mantenedores suelen responder en 1 día
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404Abiertodocumentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
ClickHouse/clickhouse-go#2185 ·
Los mantenedores suelen responder en 1 día
-
bug needs triage receiver/podman
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · 1 comentario ·
Los mantenedores suelen responder en 1 día