NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Ask HN: Best way to learn STM32 and embedded for beginner
the__alchemist 2 days ago [-]
Start with a project you think should exist, but doesn't, or doesn't exist well. Make it happen. I think the blinky, keyboard, and e-paper display tutorials and demos are perhaps not the best way to stay motivated. I think your smart watch project is perfect! With the following exception: Designing space and power-efficient PCBs and firmware are their own challenges, and may be a distraction if you're new to this in general. I.e, the PCB design goes from connecting-the-things to an intricate puzzle full of tradeoffs.

To add further confusion, consider rust. The flashing and debugging is easier, but the library ecosystem is a bit of a mess. On the plus side for learning, you will get comfortable with data sheets!

Btw, regarding HAL vs register-level programming... I think if you end up not using a HAL, you will end up writing a subset of one naturally as you create practical abstractions. Your call!

Note: There are general 3 types of manuals you will encounter for STM32:

  - Reference Manual: Details on the MCU family broadly. Use this as your guide to programming and peripheral capabilities.
  - User manual: Details on the specific MCU. Use this for pin mappings, and which peripherals are available on a given package
  - Dev board datasheet: If using a dev board, this describes which pins are mapped to which external pins, onboard peripherals etc.
Don't get too overwhelmed with all the STM32 varieties. The family tree is sprawling, but peripherals are usually heavily conserved. With many exceptions to keep things interesting... A lot of the maker-oriented material points towards older ones; I would skip those, as working with the relatively newer ones tends to be a bit easier. (i.e. no reason to use an F3, F4, F0 etc on a new project)
skoopsy 1 days ago [-]
Excellent, I'll stick with my lofty smart watch goal then. I do have some intermediate steps like running some sensor fusion from an IMU in real time. So hoping I can build up a system, add peripherals, then transfer off a dev board, then keep iterating and adding complexity over time.

Rust looks very cool and is probably the future. To lower complexity it seems to make sense for me to stick with the familiarity of C from a bunch of Arduino projects (Although mostly Arduino IDE and Libraries) and some C++ projects (not embedded), but maybe I don't know what's good for me there, is there an equivalent to shooting yourself in the foot or blowing your whole leg off in Rust?

It seems to make sense to dabble with registers enough to be confident in understanding what the HAL is doing whilst learning, I find taking a peek at the lower levels of abstraction can really impact how to use libraries best?

"Reference Manual" - Brilliant! Just took a look and this is going to help me get my bearings so much, thank you!

STM32 family is definitely overwhelming - I was tempted to pickup a F0 Nucleo to match the tutorials but I'll take that advice and stick with the F1 Nucleo that was given to me.

j4nek 11 hours ago [-]
you are on the right way if using HAL feels like cheating! i always recommend starting with implementing a UART bare metal, since you will need a UART for debugging / talking with the chip all the time.
showmexyz 2 days ago [-]
https://leanpub.com/mastering-stm32-2nd

This is good book to start learning. Don't worry too much about using HAL. You can dig deeper by implementing HAL functions yourself. The thing is if you are making a product, using a HAL is generally a good solution. Also keep datasheet of specific microcontroller nearby.

skoopsy 1 days ago [-]
Thanks, I'll take a look!
brudgers 2 days ago [-]
[random advice from the internet]

The best way for a beginner to learn X is to not spend time on finding the best way to learn X...

...and instead get to the hard work of learning X.

build my own Smart watch based on a Cortex M33 or M55. QSPI flash, I2C sensors, bluetooth, power management, some DSP

Just start now because actualizing that word salad is a muliti-year project. Alternatively, buy a smart watch instead and be done with it. "Some DSP" is at least a four year degree equivalent.

used a HAL library and it feels like cheating

Cheating how?

Good luck.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 08:09:11 GMT+0000 (Coordinated Universal Time) with Vercel.