cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 vs STM32F411 vs STM32F303

ValterMatos
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions

> 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.

View solution in original post

14 REPLIES 14
Ozone
Principal II

> 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.

Andrew Neil
Super User

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

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
ValterMatos
Associate II

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


@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.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
ValterMatos
Associate II

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.


@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)

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
ValterMatos
Associate II

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

gbm
Principal

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)?

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

@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.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.