Skip to main content
Visitor II
November 25, 2025
Solved

STM32L476 vs STM32F411 vs STM32F303

  • November 25, 2025
  • 9 replies
  • 456 views

Good morning.

I'm still trying to develop in STM code.

I have an open-source code developed for the STM32L476.

Questions:

If I generate a compiled HEX for the STM32L476, will it run on the 411?

Are they compatible?

Is it possible to migrate to an STMF303 or an STM32F411?
These are the ones I have to continue developing my studies.

I still don't have enough knowledge.

I've been trying to adapt it to the various available STM controllers.

Thank you.

Valter Matos

    This topic has been closed for replies.
    Best answer by Ozone

    > This is a project whose main focus is electronics, building an oscilloscope that can serve as a simple study tool.
    > The "front-end" for signal processing is already ready. The chip programming is missing.

    Choosing a general-purpose MCU like a Cortex M4 for this purpose means relatively moderate specs / requirements.

    > Programming in STM is part of the learning process.
    > I don't have much experience with STM.

    Not the best starting conditions, I would say.
    A result with acceptable performance require some advanced understanding, hours of studying reference manuals & datasheets, and some experience.

    > The chip has two ADCs, the F411 only has one, and I believe that the F303 is the best for this case, even though it's obsolete.

    Is the F303 obsolete ? I think not.
    You don't need two ADCs, just two or more channels of one ADC.
    The small gain in sample frequency from using interleaved dual/triple mode ist most probably not worth the extra effort.

    > As you can see from the code, the ADC, SPI, DMA, etc. handling is separate.

    There is  a bit more involved here.
    For proper performance you need to link the ADC with DMA, to unload the core. And most probably link it to a timer as sample time base.
    This requires some planning and reference manual consultation, especially if you need flexible sample rates and buffer sizes.
    In addition, the F303 is quite limited in RAM and Flash size. And not all RAM is accessible by DMA.

    9 replies

    Explorer
    November 25, 2025

    > If I generate a compiled HEX for the STM32L476, will it run on the 411?
    > Are they compatible?

    Short answer - no.
    Flash and RAM sizes are different, peripherals (number, address, features) are different, "special" RAM regions are different. Even sub-variants of many MCUs are not directly compatible (e.g. F303xB/C/D/E vs. F303x6/8).

    > Is it possible to migrate to an STMF303 or an STM32F411?

    Yes, of course.
    I have migrated projects between F0, C0, F3 and F4 devices successfully, although it takes some effort.
    The behavior of many peripherals is slightly different in many variants.

    Unless, of course, you use a (HAL) abstraction layer like MicroPython, Arduino, or a RTOS with appropriate drivers. Which is not what you mean, I suppose.

    Super User
    November 25, 2025

    See AN3364Migration and compatibility guidelines for STM32 microcontroller applications.

     

    Specifically for STM32, using HAL should help: your will use a different HAL version for the different targets, but they should present a (largely) common interface to your software.

     

    General principle for making any software portable is to isolate hardware dependencies into as few places as possible - so that only those few places will need changing to change target.

     

    Here's how I have common code running on different targets in CubeIDE:

    https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/same-touchgfx-project-for-multiple-cubemx-files-in-the-same/m-p/672534/highlight/true#M37503

     

    Visitor II
    November 25, 2025

    Thank you.

    Before abandoning the STM series.

    I will try to migrate using the knowledge I have in STM.

    I will use CUBE MX to generate the code and try to migrate the source code. I don't have the knowledge to start from scratch.
    I have knowledge of the Arduino IDE, which is not the case now.
    One of the difficulties I find with STM products is the large diversity of families and the lack of compatibility between them.

    Thank you again.

    Valter Matos

    Super User
    November 25, 2025

    @ValterMatos wrote:

    I will use CUBE MX to generate the code


    CubeMX just generates the configuration stuff specific to the particular target chip.

    The "business logic" of your application should be separate from this.

    If it is not well separated, I strongly suggest that you start by making it so on the original L476 version.

    This will make it much easier to then port to your other target(s).

     

    I suggest that you keep all of your "own" code out of the files generated by CubeMX

     


    @ValterMatos wrote:

    One of the difficulties I find with STM products is ... the lack of compatibility between them.


    Not sure what  you mean by that?

    There is a great deal of compatibility between them - when a feature is present on two different chips, it generally works the same on both.

    Again, using HAL helps with this.

    Visitor II
    November 25, 2025

    I will try to keep the resources independent of the chip.
    One of the difficulties now is the use of SPI1 and 2. It seems to me that the pins are different between the L476 and the 411, and I have 303 and 411 boards for my studies.
    The only direct pin compatibility I know of so far is between the 103 and the 303.
    It is possible to replace the chips.
    I don't know how to use HAL very well.
    I will try.
    Thank you.

    Super User
    November 25, 2025

    @ValterMatos wrote:

     It seems to me that the pins are different between the L476 and the 411, and I have 303 and 411 boards for my studies..


    Indeed, that will always be an issue - certainly not specific to STM32.

    So that is one of the key things that you need to isolate from your application.

     


    @ValterMatos wrote:

    I have an open-source code developed for the STM32L476.


    As it's open-source, why not share it?

    Then perhaps people could make suggestions...

    (probably in a separate thread)

    Visitor II
    November 25, 2025

    I'm considering porting the code to the 303CC or the 411. I have several boards from students in my electronics course.

    Which one would be best for this purpose?

    I need SPI1 and 2. Two ADCs using an ILI9488 SPI Touch display.

    I believe it's possible.

    May I share the code in this thread?

    Thank you.

    Valter Matos

    Super User
    November 25, 2025

    @ValterMatos wrote:

    Which one would be best for this purpose?


    Not really sure what the actual purpose is?

     


    @ValterMatos wrote:

    I need SPI1 and 2. Two ADCs using an ILI9488 SPI Touch display.


    Sounds quite involved if you're saying you have no STM32 experience ?

     


    @ValterMatos wrote:

    May I share the code in this thread?


    You said it's open-source - so just link to the project or GitHub or whatever.

    Graduate
    November 25, 2025

    Both F3 and F4 are more outdated than L4, so it looks like you are going backwards. F3 is almost dead, F4 still kicking.

    L4 is much more convenient than F4, although L47x is quite funny with its non-contiguous RAM. Why not H5 (new, cheap, fast) or U5 (new, low power, slightly more expensive)?

    Visitor II
    November 25, 2025

    The F303CC and F411 are the boards we have for the school project, and we don't have many resources. We would have to acquire the H5, and that could take a while.
    It's a somewhat complex project in STM programming, but with a focus on electronics. I'm still learning STM.
    I've already tried others without success.
    For this reason, I'm seeking help.
    The source code is available at:
    https://github.com/Dominik-Workshop/KD-23MTS
    I started evaluating: main.h, spi.c, and gpio.c
    If I manage to modify them, I will share them.

    I will try.

    Thank you, Valter Matos

    Super User
    November 26, 2025

    @ValterMatos wrote:

    It's a somewhat complex project in STM programming


    Indeed it is!

    Therefore I'm still unclear of the learning benefits of doing this.

    What, exactly, are the students intended to do with it?

    What, exactly, are the students intended to learn from it?

     

    The code is using HAL - so that should help porting.

    Technical Moderator
    November 25, 2025

    Dear @ValterMatos ,

    As I see you are conducting an embedded courses for students , I do not recommend also to do this porting which has no real return on investment due already existing boards which are not done for same purposes And not same applications. We can put you in contact with our office in Brazil and our FAEs will be pleased to assist you and why not to give you free boards for education.  The only common part of these MCU is the Cortex-M4 core and may be many pins are quite at same position in a LQFP64 or LQFP100 , However architecture is completely different and using very different technology and flash / NVM from 180nm , 90nm one for Control drive , second for Efficiency and another for ULP operation .

    Hope it helps you ,

    STOne-32

    Visitor II
    November 26, 2025

    This is a project whose main focus is electronics, building an oscilloscope that can serve as a simple study tool.
    The "front-end" for signal processing is already ready. The chip programming is missing.
    Programming in STM is part of the learning process.
    I don't have much experience with STM.
    I will try to port it to the F303 because that's what we have now.
    The chip has two ADCs, the F411 only has one, and I believe that the F303 is the best for this case, even though it's obsolete.
    As you can see from the code, the ADC, SPI, DMA, etc. handling is separate.
    I have already started modifying the GPIO pins using CUBEMX to generate the code and transfer the C++ part and then compile. No errors. I hope.
    Thank you for your attention.
    Valter Matos

    OzoneAnswer
    Explorer
    November 26, 2025

    > This is a project whose main focus is electronics, building an oscilloscope that can serve as a simple study tool.
    > The "front-end" for signal processing is already ready. The chip programming is missing.

    Choosing a general-purpose MCU like a Cortex M4 for this purpose means relatively moderate specs / requirements.

    > Programming in STM is part of the learning process.
    > I don't have much experience with STM.

    Not the best starting conditions, I would say.
    A result with acceptable performance require some advanced understanding, hours of studying reference manuals & datasheets, and some experience.

    > The chip has two ADCs, the F411 only has one, and I believe that the F303 is the best for this case, even though it's obsolete.

    Is the F303 obsolete ? I think not.
    You don't need two ADCs, just two or more channels of one ADC.
    The small gain in sample frequency from using interleaved dual/triple mode ist most probably not worth the extra effort.

    > As you can see from the code, the ADC, SPI, DMA, etc. handling is separate.

    There is  a bit more involved here.
    For proper performance you need to link the ADC with DMA, to unload the core. And most probably link it to a timer as sample time base.
    This requires some planning and reference manual consultation, especially if you need flexible sample rates and buffer sizes.
    In addition, the F303 is quite limited in RAM and Flash size. And not all RAM is accessible by DMA.