Adding memory to an STM32F405

Hi all,

I recently created a custom board with an stm32F405 MCU and an ENC28 PHY. This works great, but for a new project I would like to expand this design with a webserver for configuration purposes.

When I tried to run the server on the new board, I quickly ran into memory issues when serving the pages, since I have a lot of replacing to do to make the pages dynamic.

So, I’m considdering adding additional memory to the board, but this is completely new for me. I suppose I have to find a suitable chip and modify the firmware so the MCU is aware of it?

Anyone any experiece with doing something like this?

I would check STI’s Discovery boards for reference. I know that F429 has support for SDRAM and their Discovery board has it. Not sure about F405 though.

You need 100pin package as minimum to get at the FMC (Flexible memory controller) and if you want to add SDRAM you will need at least 144pin package

As a note FMC only available on F42xxx/F43xxx devices

I’m confused.
In the datasheet of the 32F405 it says: FMSC memory controller available, but only in 144 pin package.

Would that involve huge changes to the firmware in order to make it work? I was intending to use the CERB family firmware as a starting point, but I assume that won’t be simple?

@ Architect - No, also on some F40xxx and F41xxx devices. For example, the STM32F407IG. But as Bill Gates mentioned, you need one of the larger packages.

So, let’s assume I would pick the 144 pin package: What kind of changes have to be made to the firmware? I assume the MCU needs to be aware of the additional memory?

How much RAM should I add? I used my webserver before on EMX and that works fine, but I believe that EMX has 10 MB or something? Any suggestions on suitable chips?

I will take a look at the discovery reference design later tonight, as suggested by Architect.

Hmm. Then their datasheet must be wrong, unless you are talking about the FSMC and not the FMC.

FMC it’s kind of extended or replacement version of FMSC with support of SDRAM.

@ Architect - Yes, you are right… I was thinking of the FMSC, which doesn’t support SDRAM. However, one could use a pseudo-static DRAM with the FMSC.

@ NickS

Yes, you need 144 pin package.
Take a look for source code of firmware for STM3240G-EVAL.

In file “system_stm32f4xx.c” look for the function void SystemInit_ExtMemCtl(void)

That function doing SRAM initialization.

I followed suggestion by “jay”, that really helped me a lot from forum thread:

But my personal suggestion, better to go with STM32F429.

Ok, I think I have enough to get me started.
For electronics design, I will look into the discovery board.

As far as changing the firmware, I think I will get started on getting the cerb sources to compile with gcc. According to some people on the forum this is quite a challenge on its self.

@ slawek: would you mind explaining why you would go with the F429? And thank you for the link to jay’s reply.

@ Architekt: You are right about the datasheet. It mentiones FSMC.

@ NickS

Your are welcome.
About F429, it’s has more peripherals, 2MB Flash and 256KB on board and with FMC controller you can use cheaper SDRAM, but the price difference just a few bucks. I was able to compile and run cerberus firmware on it without any problems. Only the problem i had is to properly configure memory map and scatter files to use external SDRAM. But i hope guys from Oberon will release soon the source code for the firmware 4.3 and will try again.

Unless you need the tft controller use the 427 as they are easier to come by and with revision Y silicon they can run at 180mhz.

1 Like

Oh yeah, revision Y silicon and 180Mhz. STM FTW.

I too suggest just going to the 100-pin STM32F427 chip that has the extra memory. It’s probably a big change from the 64-pin you’ve been using up to now, but it is a simple change in hardware that has longer term benefits and is simpler to use since you don’t have to think about external memory.

@ Brett - I will probably use the STM32F427, but I’m affraid if the RAM is large enough though. I probably still end up adding additional memory.

@ slawek - What SDRAM did you use in your design? Any chance you would share the schematics for adding this to the F427? I was looking into the discovery reference designs, but can’t find anything that makes sense to me…

@ Bill Gates - No, I don’t need the display controller at this time. Thanks for pointing that out.

@ NickS

I have played with 32F429IDISCOVERY.

All documentation located here:

Schematics and design details:

Looks like it uses this one:

8 megabyte - not bad!

$3.45 at DigiKey:

@ Cuno
Cuno, Do you have any plans to release source code for management of external SDRAM in stm32f42x MCU’s?