machine: add a fast write-only SPI.Tx for STM32
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 64/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- go
- Área
- embedded-iot
Línea de trabajo
Start by reading the generic Transfer()/Tx in src/machine/spi_tx.go, then the STM32 SPI implementation in src/machine/machine_stm32_spi.go where the new Tx should live. Use spi.tx() in src/machine/machine_atsamd21.go and machine_atsamd51.go as the model for the write-only split, and follow the transmit-only procedure in RM0090: write each byte when TXE is set, then wait TXE=1 and BSY=0 and drain DR/SR to clear OVR. Done when Tx(buf, nil) no longer waits per byte, the final BSY wait is preserved, and a display driver such as ili9341 still works on an STM32 board.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
STM32 targets that use machine_stm32_spi.go don't have their own SPI.Tx. They use the generic one in src/machine/spi_tx.go, which calls Transfer() once per byte. Transfer() waits for RXNE, then TXE, then BSY on every byte, so the bus goes idle between bytes. The comment in Transfer() already says so:
this will effectively prevent this Transfer() function from being capable of maintaining high-bandwidth communication throughput
SPI displays suffer the most (ili9341, st7789, st7735, ssd1351 and others), because almost all their traffic is long write-only bursts with Tx(buf, nil).
SAMD21 and SAMD51 already solve this. Their Tx has a write-only path (spi.tx() in machine_atsamd21.go and machine_atsamd51.go) that writes the next byte as soon as the data register is empty, and only waits for completion and drains RX at the end.
Proposal: give STM32 its own Tx with the same split.
- Write-only (
r == nil): write each byte to DR when TXE is set, without waiting for RXNE or BSY per byte. At the end, wait for TXE=1 and BSY=0, then read DR and SR to clear OVR. This is the transmit-only procedure from the SPI chapter of the STM32F4 reference manual (RM0090). - Read and read/write: keep the current per-byte behaviour for now, or pipeline them the same way later.
Waiting for BSY=0 once at the end keeps the current guarantee that the last byte is on the wire when Tx returns, so drivers that raise CS right after Tx keep working.
Background: tinygo-org/drivers#196 (2020) worked around this with an STM32F4-specific backend inside the ili9341 driver. The conclusion back then was that the fix belongs in the machine package, so every SPI driver on STM32 benefits and not only one display. I'm closing that PR in favour of this issue.
- Lenguaje dominante
- Go
- Estrellas
- 17.8k
- Forks
- 1.1k
- Merge medio
- 1 d 4 h
- PR fusionados (30 d)
- 380
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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/tinygo
-
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
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
tinygo-org/tinygo#6711 ·
Los mantenedores suelen responder en 1 día
-
Builds are not reproducible: cgo snippet paths in debug infoPosiblemente ocupada @tridev-tej la tomó hace 1 día. Abiertoenhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
tinygo-org/tinygo#6619 ·
Los mantenedores suelen responder en 1 día
-
Fix the targets that tinygo build -target rejectsPosiblemente ocupada @narguis la tomó hace 2 días. Abiertobug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
tinygo-org/tinygo#6617 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
tinygo-org/tinygo#6312 ·
Los mantenedores suelen responder en 1 día
Todos los issues de tinygo-org/tinygo
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
-
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
-
tagvalue.Read fails with "token too long" on lines over 64 KiBPosiblemente ocupada @G26karthik la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
spdx/tools-golang#319 ·