machine: add a fast write-only SPI.Tx for STM32
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 64/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Go
- Star
- 17.8k
- Fork
- 1.1k
- Merge trung bình
- 1 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 380
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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/tinygo
-
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
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
tinygo-org/tinygo#6711 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Builds are not reproducible: cgo snippet paths in debug infoCó thể đã có người làm @tridev-tej đã nhận 1 ngày trước. Đang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
tinygo-org/tinygo#6619 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Fix the targets that tinygo build -target rejectsCó thể đã có người làm @narguis đã nhận 2 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
tinygo-org/tinygo#6617 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
tinygo-org/tinygo#6312 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của tinygo-org/tinygo
Issue tương tự
-
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
-
help wanted
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
oras-project/oras-go#1827 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ClickHouse/clickhouse-go#2185 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs triage receiver/podman
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
tagvalue.Read fails with "token too long" on lines over 64 KiBCó thể đã có người làm @G26karthik đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
spdx/tools-golang#319 ·