Skip to main content
VinceTai
Associate II
April 30, 2025
Solved

External Flash for STM32F439Zi

  • April 30, 2025
  • 2 replies
  • 862 views

Dear Sir/Madam,

Good day~

I am currently using STM32F439ZI for the purpose of developing BMS.

However, the code size exceed the internal Flash capacity, which is 2MB.

To address this, I intend to add an external Flash (MXIC:MX25L25645G).

May I know whether the external Flash can connect to any of the six SPIs available on the STM32F439ZI?

or there are specific SPIs for interfacing with external Flash?

Any guidance would be appreciated.

Vince

Best answer by Pavel A.

From the data sheet of this flash, it has compatibility mode with simple SPI. Then yes it should work with any of SPIs of STM32F4, but will be quite slow.

2 replies

Pavel A.
Pavel A.Best answer
Super User
April 30, 2025

From the data sheet of this flash, it has compatibility mode with simple SPI. Then yes it should work with any of SPIs of STM32F4, but will be quite slow.

VinceTai
VinceTaiAuthor
Associate II
April 30, 2025

Dear Pavel, 

Thank you for your prompt reply.

I have been searching through the STM32F439ZI datasheet for compatibility information, but I couldn't find any clues, appreciate your help.

Vince

Pavel A.
Super User
April 30, 2025

Hi @VinceTai , the data sheet ch. 8, page 13 describes the operation of the flash in simple SPI mode (4-wire MISO, MOSI, CLK, CS). How to set up the SPI on STM32F4 side you can find in the ST examples. (the data sheet also mentions DTR mode, but STM32F4 does not support this so refer to STR mode only).

If you are new to STM32 and would like more help with the tools and coding, here this is available.

 

Peter BENSCH
Technical Moderator
April 30, 2025

Well, it's a bit confusing for me that on the one hand you use a STM32F439 with hardware-accelerated AES (STM32F429 is generally the same, but without H/W AES) and then want to connect an external flash for code that can be read freely via the SPI bus.

But regardless of this, SPI cannot be memory-mapped on the family of STM32F4, so code must first be copied to internal RAM before it can be executed. Newer families of STM32 like e.g. STM32H563 provide Quad- or Octo-SPI which can be memory-mapped.

Regards
/Peter

Pavel A.
Super User
April 30, 2025

Necessity is mother of invention ))  In this situation we split some code to small overlays, loaded (and decrypted) from external flash and run in the RAM.