Author Topic: Learning STM32  (Read 4085 times)

0 Members and 3 Guests are viewing this topic.

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6183
  • Country: gb
  • Doing electronics since the 1960s...
Re: Learning STM32
« Reply #25 on: November 28, 2026, 03:43:34 pm »
I agree CubeMX is a bit pointless today. It's main use was in easy pin allocation and then getting startup code generated for that. That stuff is quite finnicky because the pin mapping arrangement is complicated, with hundreds of muxes connecting different pins to different peripherals, and you are doing tradeoffs all the way. For example in my last project I wanted four serial ports and to get that I had to lose access to SPI1. Later this was fixed by losing the SWO debugprint feature - I posted a thread on how to do that. But now you can just tell Claude what you want and it will allocate the pins and generate the C code to set up the muxes (what is called "AF - alternate function").

The guy working on my thing before me used MX to set it up (in 2016) but I never used MX again. That same platform (with FreeRTOS, LWIP, FATFS, etc) has been used for a number of projects since, which illustrates well that picking a decent chip will do your requirements for many years.
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online tooki

  • Super Contributor
  • ***
  • Posts: 16157
  • Country: ch
Re: Learning STM32
« Reply #26 on: November 28, 2026, 10:31:16 pm »
During covid you could not get them, but during covid you could not get a lot of stuff... so a lot of people went to the chinese Espressif ESP32, which is another "arm32" chip which a lot of people like.
ESP32 are not ARM based at all (which is in a way surprising for 32-bit MCUs/SoCs). Traditional ESP32 models use licensed Xtensa cores, but all newer models are based on the open-source RISC-V architecture. (Some Xtensa models even have an ultra-low-power RISC-V core.)
 

Offline tellurium

  • Frequent Contributor
  • **
  • Posts: 345
  • Country: ua
Re: Learning STM32
« Reply #27 on: November 28, 2026, 10:38:00 pm »
ESP32 are not ARM based at all (which is in a way surprising for 32-bit MCUs/SoCs).

Not surprising - I believe Espressif was trying everything under the sun to minimize the price, and Xtensa licensing cost less then ARM. And back in the days, RISCV was not yet a thing. Meaning that likely all new Espressif parts will be RISCV.
Mongoose - a full-stack embedded network library for STM32, NXP and other - https://mongoose.ws
TCP/IP stack + drivers + TLS1.3 + HTTP/WebSocket/MQTT + OTA in a single file
 

Online tooki

  • Super Contributor
  • ***
  • Posts: 16157
  • Country: ch
Re: Learning STM32
« Reply #28 on: November 28, 2026, 11:07:33 pm »
ESP32 are not ARM based at all (which is in a way surprising for 32-bit MCUs/SoCs).

Not surprising - I believe Espressif was trying everything under the sun to minimize the price, and Xtensa licensing cost less then ARM. And back in the days, RISCV was not yet a thing. Meaning that likely all new Espressif parts will be RISCV.
For sure.

And not just likely: Espressif has explicitly said that all new models will be RISC-V.
 
The following users thanked this post: nctnico

Offline tellurium

  • Frequent Contributor
  • **
  • Posts: 345
  • Country: ua
Re: Learning STM32
« Reply #29 on: November 29, 2026, 09:04:39 am »
I'd like to ask people familiar with STM32 microcontrollers: what's the best way to get started with them?

To answer an original question
Many nice resources were mentioned already
This bare metal series on STM32 is worth mentioning too:

https://vivonomicon.com/category/stm32_baremetal_examples/

I'd start from the 1st article:
https://vivonomicon.com/2018/04/02/bare-metal-stm32-programming-part-1-hello-arm/
Mongoose - a full-stack embedded network library for STM32, NXP and other - https://mongoose.ws
TCP/IP stack + drivers + TLS1.3 + HTTP/WebSocket/MQTT + OTA in a single file
 

Offline mino-fm

  • Regular Contributor
  • *
  • Posts: 172
  • Country: de
Re: Learning STM32
« Reply #30 on: November 29, 2026, 05:11:53 pm »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4676
  • Country: us
Re: Learning STM32
« Reply #31 on: November 30, 2026, 10:47:29 pm »
Quote
There is a lot going on around the CPU, and I want to understand how all these components interact with each other.
In general, they don't.  Or they don't need to.  Once you have a basic configuration set up (flash memory wait states, oscillators and clocks (for both CPU and peripherals), etc), the peripherals might as well be completely separate chips.  They intereact when the CPU talks to them.

(Those oscilators and clocks are annoyingly complex, and a lot of people coming from simpler microconrtollers get confused.  You can copy/paste initialization code from somewhere, use the vendor libraries (also frequently annoying complex), or (probably) use an AI tool, rather than figuring it all out.

OK; that's a simplifications, but it's also "where to start.")

Some of the exceptions:
  • Interrupts:  You'll need to understand both the ARM NVIC and the way the peripherals interact with it (whether your UART generates a single interrupt for all events, or multiple interrupts, for example.)  Some chips (Renesas, for one) have additional "stuff" in between the peripherals and the NVIC, but I don't thing the ST chips are among them.
  • DMA: many 32bit microcontrollers have a general purpose DMA system for (some of) the peripherals, and high speed peripherals (USB, Ethernet) may require DMA (or similar) to operate.
  • NVM Control: The flash memory is pretty easy to set up to read/execute from, but writing to it is going to be more complex.
  • "CPU Independent Peripherals": On some chip families, manufacturers have added capabilities for peripherals to interact with each other, without involving the CPU.  Might be speedier, might allow the CPU to sleep in low power modes, etc.
  • Low power modes, including "backup memory" and such.
  • Bus interactions: most larger ARM microcontrollers have several internal buses.  This is largely irrelevant except that it can affect performance, especially if you are trying to achieve deterministic performance.  Flash memory will typically have some sort of "acceleration" to speed it up (but hard to predict.)  Ditto Caches.  Instructions that are "theoretically" single-clock cycle can take longer because a bus is slower, or because something else is using the same bus, or because clocks need to "synchronize."
 

Offline lbthomsen

  • Contributor
  • Posts: 13
  • Country: my
  • STM32World Webmaster
    • STM32World
Re: Learning STM32
« Reply #32 on: December 01, 2026, 04:41:31 am »
I'd like to ask people familiar with STM32 microcontrollers: what's the best way to get started with them?
I have an STM32 board based on the STM32F405RGT6.
What resources, books, or learning materials would you recommend for learning STM32, and how did you go about learning them yourself?

I am obviously biased, but I would recommend my own STM32World Youtube channel: https://www.youtube.com/playlist?list=PLa_T9IiuvDeA

If you prefer reading, there's a ton of info on the wiki: https://stm32world.com/wiki

//Lars...


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->