Repository navigation
stm: add paralleldisplaybus using the FSMC - #11908
Merged
Merged
Conversation
ParallelBus for the STM port, driving an 8-bit 8080-style display through FSMC bank 1 in SRAM mode: each byte is one store to 0x60000000, and the FSMC generates the write strobe. Data pins are validated against the FSMC D0-D7 pin tables (added for the STM32F412Rx), the write strobe must be FSMC_NWE and the read strobe FSMC_NOE. DC, CS and reset are GPIOs. A frequency below the slowest FSMC write (258 HCLK cycles) is refused. The FSMC register set-up follows codal-stm32's driver for this display (src/FSMCIO.cpp), used by MakeCode Arcade, except the write timing. The bus is off unless a board sets CIRCUITPY_PARALLELDISPLAYBUS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vegardw
added a commit
to vegardw/circuitpython
that referenced
this pull request
Nov 19, 2026
Brings in the FSMC parallel display bus (adafruit#11908) and the pin-table fixes (adafruit#11902), now merged upstream. The display-bus code was already the same here, so the merge had no conflicts. The tree is now main plus the board commit, the board README and Stage at the commit that adds this board. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vegardw
added a commit
to vegardw/circuitpython
that referenced
this pull request
Nov 19, 2026
The MCU, bootloader and display-bus support are now in main (adafruit#11896, adafruit#11903, adafruit#11908), as is the audiopwmio silent-source fix (adafruit#11889). Say so, update the base and free flash, and state briefly what was tested on the device and what wasn't. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
paralleldisplaybus.ParallelBusto the STM port, using the FSMC, with FSMC pin tables for the STM32F412Rx package from #11896. No upstream board enables it yet: the ELECFREAKS Retro Arcade will, in its board PR.Problem
The Retro Arcade's ILI9341 display (320×240) is wired to the STM32F412's FSMC as an 8-bit 8080-style bus: D0–D7 on the FSMC data pins, the write strobe on FSMC_NWE. The STM port has no
paralleldisplaybusbackend, so it can't drive it.Fix
A write-only, 8-bit
ParallelBuson FSMC bank 1 in SRAM mode. Each byte is one store to0x60000000, and the FSMC clocks it out with a write pulse. Command, chip select and reset are GPIOs; no FSMC address lines are used.data_pinsmust be the FSMC D0–D7 pins in order,writean FSMC_NWE pin andread(if given) FSMC_NOE, checked against new pin tables before anything is claimed. Thedata0=form is refused: the FSMC data lines aren't consecutive GPIOs.frequencysets the write timing (DATAST), so the bus never runs faster than asked. A write takes DATAST + 3 HCLK cycles and DATAST is at most 255, so afrequencybelow the slowest write (258 cycles, 387597 Hz at 100 MHz) is refused instead of running faster.deinit()does nothing for a bus whose constructor refused, as on the other ports, so a refused second bus can't turn off the FSMC under a working display when its slot is released.CIRCUITPY_PARALLELDISPLAYBUSstays off unless a board turns it on.Testing
On an ELECFREAKS Retro Arcade (STM32F412RE) with its board definition (not yet upstream), on main
e8042e8c9d(which includes #11896), using the script below:data0=;frequency=100_000ValueErrorParallelBuswith the board's pins, and aBusDisplaysend()ParallelBus(free, non-FSMC pins) on a test build with two display slots, released whencode.pyendsdeinit()guard the board hard-faults into safe mode at that pointThe last row isn't part of the script: it used test builds that set
CIRCUITPY_DISPLAY_LIMITto 2 (the Retro Arcade has one slot, so it can't happen there), with and without the guard, and acode.pythat only tries the second bus. The same checks without the frequency refusal passed earlier on macOS and Linux, with the same timing; the REPL,displayioand Stage also display correctly on this board. Boards that don't enable it build to byte-identical firmware (Meowbit inru, Feather STM32F405 Express, F412ZG Discovery, Swan R5, Nucleo H743ZI2), on the same main. The branch was then rebased onto main15f9a04b06, which only adds vectorio, LVGL and Zephyr changes; there the Retro Arcade builds, and the Meowbit (ru) and F412ZG Discovery images are still unchanged by this PR. No upstream STM board enablesCIRCUITPY_PARALLELDISPLAYBUSyet, so CI compiles this backend only once a board does.How to run the test
You need an STM32F412Rx board with an 8-bit parallel ILI9341 on the FSMC pins (the Retro Arcade), or adapt the pins and init sequence. Copy the script as
code.pyand watch the serial console and the screen:cp parallelbus_test.py /media/$USER/CIRCUITPY/code.py python3 -m serial.tools.miniterm /dev/ttyACM0 115200Expect six PASS lines, the timing, and red, green, blue and white bars. The script releases the board's display, so hard-reset afterwards to get
board.DISPLAYback.parallelbus_test.pyTrade-offs and Alternatives
ParallelBusis refused because its data pins are taken.FSMCIO.cpp), and the FSMC register set-up here follows that driver, except that the write timing comes fromfrequency.frequencythe FSMC can't go down to is refused rather than silently run faster.Generative AI
I used generative AI (Claude Code and Codex) to write and test this change. I have reviewed it, and I am responsible for the code and this description.
🤖 Generated with Claude Code