-
Notifications
You must be signed in to change notification settings - Fork 1.4k
stm32: FMC SDRAM Overhaul, NAND and NOR/PSRAM/SRAM Support #5293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
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 |
…-fmc` dependencies
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.