← index #6237PR #3940
Related · medium · value 1.476
QUERY · ISSUE

STM32F407 uses FSMC problem

openby hu-luopened 2020-07-10updated 2025-10-03
port-stm32

Hello everyone, I transplant MicroPython to STM32F407. Now I need to use FSMC of STM32F407. but STM32F407 only has FSMC. I see that STM32F429DISC and STM32F769DISC have FMC support. How can I modify STM32F407 to use FSMC or FMC?
Thanks for your help.

CANDIDATE · PULL REQUEST

stm32: add sdram support

closedby andrewleechopened 2018-07-12updated 2018-08-06

This PR adds stm32 support for using external SDRAM chip for the micropython GC heap.

On the (included) STM32F429DISC target this means you now have 8MB of ram for python to use!

I expect this PR to need a little further work before merging however. While I believe it's fully operational and stable, I'm pretty sure some of my changes to alternate pin function handling could be done better.

It includes also a rather long list of pins needing to be defined in multiple locations. This is the first time I've worked with the alternate function handling, not sure if I've understood it correctly/efficiently?

In particular I had problems with the FMC perpheral configuration as the existing functionality wants to set it to unit 0 but the register definition is just FMC, hence my change in stm32f4xx_prefix.c. I don't know that this change is safe for all stm32 targets.

Even then I still needed a define in mpconfigboard.h to set the active FMC register #define FMC FMC_SDRAM_DEVICE
This limits the FMC peripheral in alternate function handling to one of the possible memory types, and sets a fairly non-specific define FMC that could conflict elsewhere.

I based the initial driver on an old (unused?) driver from openmv, as such I've referenced where it came from in the initial commit and left their header intact.
I havne't contacted them about this yet, I hope this is ok? I've modified the file fairly significantly from the initial version.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied