machine: add a fast write-only SPI.Tx for STM32
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 64/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- embedded-iot
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 17.8k
- Fork
- 1.1k
- Merge medio
- 1g 4h
- PR unite (30g)
- 380
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tinygo-org/tinygo
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tinygo-org/tinygo#6727 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
tinygo-org/tinygo#6711 ·
I maintainer di solito rispondono entro 1 giorno
-
Builds are not reproducible: cgo snippet paths in debug infoForse già presa @tridev-tej l’ha presa 1 giorno fa. Apertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tinygo-org/tinygo#6619 ·
I maintainer di solito rispondono entro 1 giorno
-
Fix the targets that tinygo build -target rejectsForse già presa @narguis l’ha presa 2 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
tinygo-org/tinygo#6617 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
tinygo-org/tinygo#6312 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di tinygo-org/tinygo
Issue simili
-
release
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
github/gh-aw-mcpg#17603 ·
I maintainer di solito rispondono entro 1 giorno
-
help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 94/100
oras-project/oras-go#1827 ·
I maintainer di solito rispondono entro 1 giorno
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404Apertadocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ClickHouse/clickhouse-go#2185 ·
I maintainer di solito rispondono entro 1 giorno
-
bug needs triage receiver/podman
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
tagvalue.Read fails with "token too long" on lines over 64 KiBForse già presa @G26karthik l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
spdx/tools-golang#319 ·