stm32: FMC SDRAM Overhaul, NAND and NOR/PSRAM/SRAM Support#5293
Draft
northernpaws wants to merge 30 commits intoembassy-rs:mainfrom
Draft
stm32: FMC SDRAM Overhaul, NAND and NOR/PSRAM/SRAM Support#5293northernpaws wants to merge 30 commits intoembassy-rs:mainfrom
northernpaws wants to merge 30 commits intoembassy-rs:mainfrom
Conversation
Contributor
Author
|
I got most of the SDRAM driver written over the last few hours, but there are still a few areas I think it could be improved. I need to update most of the examples to support the new driver, so reworking the |
northernpaws
commented
Jan 29, 2026
…-fmc` dependencies
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.
This PR intends to overhaul the STM32 FMC driver to resolve several issues with the current driver, and to fill it out with a variety of missing features. In particular, the FMC driver in it’s current state doesn’t support the NAND and NOR/PSRAM/SRAM banks which are essential for features advertised for some of the high-performance STM32 devices, such as driving an 8080 parallel display with the FMC.
Some of the issues that this PR aims to resolve:
stm32-fmccrate backing the current driver appears to be abandoned, and is severely feature-incomplete.stm32-fmccrate also supplies its own set of registers that are not backed by metapac, so their correctness is not validated across STM32 families.stm32-fmccrate configures global SDRAM settings that apply to both banks in the configuration for a single bank.fmc_sdram_constructoronly allows configuring the pin alternate functions for SDRAM, and doesn’t allow for multi-protocol buses like the FMC supports.With this PR I aim to:
Integrate the FMC driver functionality into theembassy-stm32crate as a new driver re-written from scratch, removing the need for an external unmaintained, and feature-incomplete dependency.Use the STM32 metapac to configure the registers, taking advantage of the strong typing and compile-type correctness safety offered by it.Integrate support for dual SDRAM banks to allow for full use of the FMC.Correctly type the SDRAM timing fields so they can’t allow values out-of-bounds.Strongly-type the SDRAM configuration fields where possible (i.e. with enums), so invalid configuration are not possible.Change SDRAM register path on newerfmc_v4MCUs.Add a NAND controller driver.fmc_sdram_constructorfunctionality to allow for configuring the pins for the various kinds of devices/protocols the FMC supports, including multiple functions on the same bus.Add a NOR/PSRAM/SRAM driver.Add mapping-aware base address resolution for memory-mapped addresses, so that the driver can derive the correct address if the end-user has enabled swapping of the SDRAM and NOR/PSRAM/SRAM banks.I’ll update that list with any other improvements or additions as I come across them!
Things that will need to be tested:
This should hopefully get the state of the STM32 FMC driver on-par (or better!) then the FMC drivers for HALs from other frameworks/languages, greatly improving on this one area where the Embassy STM32 HAL is currently lacking compared to others.