Any good learning resources for STM32? - Page 1
Forum section: electronics / general

author: Emil
author_rank: Regular Contributor
timestamp: December 21, 2015, 11:16:40 pm
content: I'm looking for a good resource for learning to use the STM32F0x series.There is the datasheet, programming manual and reference manual, but they are more useful as references than as a way to learn the basics. There's a lot of forum posts, blog posts and code examples around, but picking up knowledge from such fragmentet sources is a confusing way to get started.Are there any good books, comprehensive tutorials, online courses etc.?

author: dannyf
author_rank: Super Contributor
timestamp: December 21, 2015, 11:54:35 pm
content: It really depends on what you are trying to learn and how you intend to use the chips (and how comfortable you are with coding a mcu).Generally speaking, the datasheet (reference manual in this case) is really the only good way (and in my view the best way) to learn about a chip. Yes, the learning curve is quite steep but after awhile you get your way around it.Most of those chips are not meant to be coded in assembly. So unless you are doing something extraordinary, reading the ARM instruction book (and the "definitive guides" from Yiu) is of no practical value to a practitioner - I have all of them and I rarely read them.Most of those chips are programmed through libraries, mostly with OEM libraries and sometimes with proprietary firm-specific libraries. Generally speaking, there is no good resource for those libraries - you pretty much have to reverse engineer the code by cross-referencing the code to the datasheet(=reference manual here). The level of difficulties here depends greatly on the quality of the libraries you use and examples provided by the library vendors. Unfortunately, ST isn't well known for providing quality libraries, to put it mildly if you stick with the OEM library (=standard peripheral library. The Cube is far worse and in my view should be avoided at all cost).So the best advice I can give you is to read the datasheet/reference manual as many times as you can, and then practice coding as much as you can.

author: westfw
author_rank: Super Contributor
timestamp: December 22, 2015, 06:51:02 am
content: The datasheet ("reference manual") isn't too bad, especially with several different libraries to compare it to (by looking at the source code.)An additional problem with the libraries is that they aren't documented well enough to EXPLAIN the hardware, and they're not abstract enough to permit you to get by without understanding the hardware. The 32f0xx chips should be relatively simple compared to the bigger chips, I think.

author: Brutte
author_rank: Frequent Contributor
timestamp: December 22, 2015, 08:35:26 am
content: Quote from: Emil on December 21, 2015, 11:16:40 pmI'd start from listing of thorough understanding of ANSI C (and friends), then comes tweaking of the toolchain (that is: compiler, linker, librarian, simulator, debugger) and accompanying environment (at least: make, version control and unit testing suite). After that there is the underlying Cortex M core (M0 in your case) and finally the peripherals on top.If your question is about the peripherals then bare metal Standard Peripheral Libraries (SPL) from STM are quite easy to understand and well documented, each peripheral comes with number of dumb 101 examples.However, Cortex-M are designed to operate with OS (to reduce development cost) so bare metal SPL clearly stands in contradiction with that. You can Hello World or blink a LED with SPL but forget about running multiple threads on one uC with SPL - no concurrency, no reentrancy, no resource protection.So STM released the Cube version of peripheral libraries that do support OS environment (with protection) and although you can theoretically use Cube for bare metal and ignore the OS mechanisms involved, that is not what it was designed for. Using Cube requires deeper understanding of what is going on than dumb SPL because it involves a lot of OS-necessary code (that can be ignored or even commented-out for bare metal stuff).If you are already proficient in underlying vendor-independent stuff then I'd suggest the SPL and examples there as next.EDIT: The new OS-aware peripheral library from STM Cube is called "HAL Library", which stands for: Hardware Abstraction Layer.Whatever.