machine: add a fast write-only SPI.Tx for STM32
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 64/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- go
- 領域
- embedded-iot
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Go
- スター
- 17.8k
- フォーク
- 1.1k
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 380
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tinygo-org/tinygo のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tinygo-org/tinygo#6727 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
tinygo-org/tinygo#6711 ·
メンテナーはふだん 1 日以内に返信
-
Builds are not reproducible: cgo snippet paths in debug info対応中かも @tridev-tej が 1 日前に担当しました。 オープンenhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tinygo-org/tinygo#6619 ·
メンテナーはふだん 1 日以内に返信
-
Fix the targets that tinygo build -target rejects対応中かも @narguis が 2 日前に担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
tinygo-org/tinygo#6617 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
tinygo-org/tinygo#6312 ·
メンテナーはふだん 1 日以内に返信
tinygo-org/tinygo の issue をすべて見る
似ている issue
-
release
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
github/gh-aw-mcpg#17603 ·
メンテナーはふだん 1 日以内に返信
-
help wanted
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
oras-project/oras-go#1827 ·
メンテナーはふだん 1 日以内に返信
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404オープンdocumentation
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
ClickHouse/clickhouse-go#2185 ·
メンテナーはふだん 1 日以内に返信
-
bug needs triage receiver/podman
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
tagvalue.Read fails with "token too long" on lines over 64 KiB対応中かも @G26karthik が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
spdx/tools-golang#319 ·