Author Topic: Book/learning material: Any advice for beginners?  (Read 1694 times)

0 Members and 1 Guest are viewing this topic.

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Book/learning material: Any advice for beginners?
« on: February 08, 2023, 11:12:25 am »
Hey EEV-folks,
I'm looking into knowledge material for hobbyists to better understand the inner workings of STM32 µCUs. I am trained in C/C++ but nothing specifically regarding embedded programming.
For example : the different elements : clocks and prescalers, timers, registers, (etc.) and how they work with each other. In other words, having a clue about what STM32MXCube does. And other aspects of µCUs.
I'm looking at what ST's website offers in their e-learning section, and refer to their pletnifull different docs.
I also spotted Donal Norris' book "Programming With STM32: Getting Started With the Nucleo Board and C/C++" ISBN: ‎ 978-1260031317
Any opinion, advise, pointers?
Thanks for reading!
Because "Matth" was already taken.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 3996
  • Country: nz
Re: Book/learning material: Any advice for beginners?
« Reply #1 on: February 08, 2023, 11:30:54 am »
Have you looked at the datasheet?
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Book/learning material: Any advice for beginners?
« Reply #2 on: February 08, 2023, 11:37:31 am »
> Have you looked at the datasheet?

Both datasheet and reference manual. And then rest of the related documentation.

> In other words, having a clue about what STM32MXCube does.

CubeMX is a clicky configurator for Cube (which is the "library"), and that in turn implements a relatively miniscule subset of what the hardware allows - the "most common cases".

I don't think there is any reason to "learn Cube/CubeMX". Learn the mcu.

JW
 

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Re: Book/learning material: Any advice for beginners?
« Reply #3 on: February 08, 2023, 12:13:47 pm »
> Have you looked at the datasheet?

Both datasheet and reference manual. And then rest of the related documentation.

> In other words, having a clue about what STM32MXCube does.

CubeMX is a clicky configurator for Cube (which is the "library"), and that in turn implements a relatively miniscule subset of what the hardware allows - the "most common cases".

I don't think there is any reason to "learn Cube/CubeMX". Learn the mcu.

JW

I mean understanding what it does, as in having an idea as to what the different parameters are; without being too specific.
Because "Matth" was already taken.
 

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Re: Book/learning material: Any advice for beginners?
« Reply #4 on: February 08, 2023, 12:16:05 pm »
Because "Matth" was already taken.
 

Offline Sherlock Holmes

  • Frequent Contributor
  • **
  • !
  • Posts: 570
  • Country: us
Re: Book/learning material: Any advice for beginners?
« Reply #5 on: February 08, 2023, 03:50:38 pm »
Hey EEV-folks,
I'm looking into knowledge material for hobbyists to better understand the inner workings of STM32 µCUs. I am trained in C/C++ but nothing specifically regarding embedded programming.
For example : the different elements : clocks and prescalers, timers, registers, (etc.) and how they work with each other. In other words, having a clue about what STM32MXCube does. And other aspects of µCUs.
I'm looking at what ST's website offers in their e-learning section, and refer to their pletnifull different docs.
I also spotted Donal Norris' book "Programming With STM32: Getting Started With the Nucleo Board and C/C++" ISBN: ‎ 978-1260031317
Any opinion, advise, pointers?
Thanks for reading!

I too have a lot of experience with C and studied electronics, communications, radio etc etc before embarking upon a career as a programmer, but I had little recent exposure to MCUs.

Here's what I did and what I recommend:

1. Use Visual Studio (not Visual Studio Code) then install VisualGDB, these two together are excellent, certainly for someone just starting out.
2. Install the STM Cube app too.
3. Get some STM32 F4 boards like these:

https://www.amazon.com/gp/product/B01I8XLEM8/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

4. Get these books (The Norris one is certainly helpful)

https://www.amazon.com/gp/product/1260031314/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
https://www.amazon.com/gp/product/0997925949/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

5. Do this basic example from the VisualGDB STM32 tutorials section.

VisualGDB is excellent, you can create from-scratch projects or import existing projects created by Cube.

Here's a tutorial specifically for this board.

A scope and stuff can help too, these gizmos basically consume and produce signals so being able to see them is a huge help.

The device's datasheets are a good reference but unhelpful to someone just starting out, you need to know what questions to ask first and have to start somewhere, that second book is more technical though and will prepare you for eventually studying the datasheets.








« Last Edit: February 08, 2023, 04:08:43 pm by Sherlock Holmes »
“When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.” ~ Arthur Conan Doyle, The Case-Book of Sherlock Holmes
 
The following users thanked this post: Watth

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3623
  • Country: nl
Re: Book/learning material: Any advice for beginners?
« Reply #6 on: February 08, 2023, 04:48:55 pm »
If you really want to learn about the working of the peripherals try searching the web for information about this in general, not just the STM32 setups. Like a search for "microcontroller timer peripheral" can lead you to this.

Like others wrote, the reference manual is the place to find information about how to use them and what the register settings mean, but it does not tell much about the inner workings. For this you have to look into digital circuits.

If it is to learn how to use the STM32 peripherals specific, then I suggest to get yourself some hardware like a bluepill (STM32F103) including a ST-link V2 or V3 or a clone and think up of things you like to do with it. It depends on how much money you want to throw at it and how fast you want it. You can search Aliexpress or Amazon to find yourself some interesting boards.

The ST-link will allow programming and debugging, but you need some IDE for it, unless you like command line tools. It is possible to use GDB and openOCD on command line level to do all the needed tasks.

I myself use an old version of Netbeans IDE on Linux, but there are many other IDE's for it.

To go in deep I would say, forget about CubeMX and all other by STM32 supplied tools and their HAL. Go bare metal. It is not hard. For example see some of my work here.

Depending on what OS you are on you can pick your poison, be it Microsoft or some open source setup.

When you have your setup just start programming and see if it works like you expect it to work. Having some tools to measure things can also be handy when working on peripherals. Like an oscilloscope to check if the pins are indeed making the intended PWM signal or that the SPI signals are what you expected.

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Re: Book/learning material: Any advice for beginners?
« Reply #7 on: February 08, 2023, 08:22:40 pm »
Hey EEV-folks,
I'm looking into knowledge material for hobbyists to better understand the inner workings of STM32 µCUs. I am trained in C/C++ but nothing specifically regarding embedded programming.
For example : the different elements : clocks and prescalers, timers, registers, (etc.) and how they work with each other. In other words, having a clue about what STM32MXCube does. And other aspects of µCUs.
I'm looking at what ST's website offers in their e-learning section, and refer to their pletnifull different docs.
I also spotted Donal Norris' book "Programming With STM32: Getting Started With the Nucleo Board and C/C++" ISBN: ‎ 978-1260031317
Any opinion, advise, pointers?
Thanks for reading!

I too have a lot of experience with C and studied electronics, communications, radio etc etc before embarking upon a career as a programmer, but I had little recent exposure to MCUs.

Here's what I did and what I recommend:

1. Use Visual Studio (not Visual Studio Code) then install VisualGDB, these two together are excellent, certainly for someone just starting out.
2. Install the STM Cube app too.
3. Get some STM32 F4 boards like these:

https://www.amazon.com/gp/product/B01I8XLEM8/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

4. Get these books (The Norris one is certainly helpful)

https://www.amazon.com/gp/product/1260031314/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
https://www.amazon.com/gp/product/0997925949/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

5. Do this basic example from the VisualGDB STM32 tutorials section.

VisualGDB is excellent, you can create from-scratch projects or import existing projects created by Cube.

Here's a tutorial specifically for this board.

A scope and stuff can help too, these gizmos basically consume and produce signals so being able to see them is a huge help.

The device's datasheets are a good reference but unhelpful to someone just starting out, you need to know what questions to ask first and have to start somewhere, that second book is more technical though and will prepare you for eventually studying the datasheets.
So more info: I do have a few nucleo boards. I use STMCubeIDE with MX. I have an oscilloscope and a basic logic analyzer. So far I've tried I2C and SPI, for example.
I use STM32Cube IDE for now. I'll have a look at VisualGDB.
I like that Norris' book is written for non-specialist, typically people already familiar with Arduino.
I do refer a lot to datasheets as much as I can, and various docs provided by ST. I sometimes refer to ST's "Community" site.
As a hobbyist, I'm trying to go beyond cargo cult programming by being able to have an (albeit basic) idea of the different peripherals' roles.
Because "Matth" was already taken.
 

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Re: Book/learning material: Any advice for beginners?
« Reply #8 on: February 08, 2023, 08:31:06 pm »
If you really want to learn about the working of the peripherals try searching the web for information about this in general, not just the STM32 setups. Like a search for "microcontroller timer peripheral" can lead you to this.

Like others wrote, the reference manual is the place to find information about how to use them and what the register settings mean, but it does not tell much about the inner workings. For this you have to look into digital circuits.

If it is to learn how to use the STM32 peripherals specific, then I suggest to get yourself some hardware like a bluepill (STM32F103) including a ST-link V2 or V3 or a clone and think up of things you like to do with it. It depends on how much money you want to throw at it and how fast you want it. You can search Aliexpress or Amazon to find yourself some interesting boards.

The ST-link will allow programming and debugging, but you need some IDE for it, unless you like command line tools. It is possible to use GDB and openOCD on command line level to do all the needed tasks.

I myself use an old version of Netbeans IDE on Linux, but there are many other IDE's for it.

To go in deep I would say, forget about CubeMX and all other by STM32 supplied tools and their HAL. Go bare metal. It is not hard. For example see some of my work here.

Depending on what OS you are on you can pick your poison, be it Microsoft or some open source setup.

When you have your setup just start programming and see if it works like you expect it to work. Having some tools to measure things can also be handy when working on peripherals. Like an oscilloscope to check if the pins are indeed making the intended PWM signal or that the SPI signals are what you expected.

I do often refer to datasheets. My goal is far from being a specialist, and rely on ST's IDE and HAL. But I like your idea to make at least a few basic "bare metal" projects, with the tool chain you talk about.
What I didnt specify: I have a few nucleo boards and I think I'll try to program a standalone STM32.
Because "Matth" was already taken.
 

Offline Sherlock Holmes

  • Frequent Contributor
  • **
  • !
  • Posts: 570
  • Country: us
Re: Book/learning material: Any advice for beginners?
« Reply #9 on: February 08, 2023, 09:35:40 pm »
Hey EEV-folks,
I'm looking into knowledge material for hobbyists to better understand the inner workings of STM32 µCUs. I am trained in C/C++ but nothing specifically regarding embedded programming.
For example : the different elements : clocks and prescalers, timers, registers, (etc.) and how they work with each other. In other words, having a clue about what STM32MXCube does. And other aspects of µCUs.
I'm looking at what ST's website offers in their e-learning section, and refer to their pletnifull different docs.
I also spotted Donal Norris' book "Programming With STM32: Getting Started With the Nucleo Board and C/C++" ISBN: ‎ 978-1260031317
Any opinion, advise, pointers?
Thanks for reading!

I too have a lot of experience with C and studied electronics, communications, radio etc etc before embarking upon a career as a programmer, but I had little recent exposure to MCUs.

Here's what I did and what I recommend:

1. Use Visual Studio (not Visual Studio Code) then install VisualGDB, these two together are excellent, certainly for someone just starting out.
2. Install the STM Cube app too.
3. Get some STM32 F4 boards like these:

https://www.amazon.com/gp/product/B01I8XLEM8/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

4. Get these books (The Norris one is certainly helpful)

https://www.amazon.com/gp/product/1260031314/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
https://www.amazon.com/gp/product/0997925949/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

5. Do this basic example from the VisualGDB STM32 tutorials section.

VisualGDB is excellent, you can create from-scratch projects or import existing projects created by Cube.

Here's a tutorial specifically for this board.

A scope and stuff can help too, these gizmos basically consume and produce signals so being able to see them is a huge help.

The device's datasheets are a good reference but unhelpful to someone just starting out, you need to know what questions to ask first and have to start somewhere, that second book is more technical though and will prepare you for eventually studying the datasheets.
So more info: I do have a few nucleo boards. I use STMCubeIDE with MX. I have an oscilloscope and a basic logic analyzer. So far I've tried I2C and SPI, for example.
I use STM32Cube IDE for now. I'll have a look at VisualGDB.
I like that Norris' book is written for non-specialist, typically people already familiar with Arduino.
I do refer a lot to datasheets as much as I can, and various docs provided by ST. I sometimes refer to ST's "Community" site.
As a hobbyist, I'm trying to go beyond cargo cult programming by being able to have an (albeit basic) idea of the different peripherals' roles.

I'd never even heard of SPI until about a year ago, so I jumped into interfacing and NRF radio device to a Nucleo, because the NRF relies on SPI and the STM chip on the Nucleo has several SPI units.

I spent many weeks on this and made good progress, this is a small API created (fully reusable source) and a "test app" that pumped data and commands into the NRF while I watched the data flow using a logic analyzer.

Other than VisualGDB and Visual Studio, those books and the internet, I really didn't need much except a lot of patience!
« Last Edit: February 08, 2023, 09:38:18 pm by Sherlock Holmes »
“When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.” ~ Arthur Conan Doyle, The Case-Book of Sherlock Holmes
 

Offline luiHS

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Book/learning material: Any advice for beginners?
« Reply #10 on: February 08, 2023, 10:32:48 pm »

The only serious, complete and practical book on STM32, the "Mastering STM32" by Carmine Noviello. He explains absolutely everything with detail and practical examples. 910 PDF pages for $30.  I wish something similar existed for the NXP i.MX RT, but unfortunately it doesn't.

You can buy it online and download it instantly.
https://leanpub.com/mastering-stm32-2nd

 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Not An Expert
Re: Book/learning material: Any advice for beginners?
« Reply #11 on: February 08, 2023, 11:53:44 pm »
I'm going to disagree with some of the above.  As an "expert" it's hard to remember how bewildering embedded is when you first encounter it.  You can't really say "go learn how to configure everything at the register level!  Wizards and HALs are cheating!" if they have no idea what a timer is (I mean you can, but then you are just being difficult).

ST now has a pretty complete, well documented, set of tools with the STM32Cube ecosystem and nucleo boards.  It's an excellent way to get some exposure using (mostly) known working examples and wizard type configuration tools.  Use their tools!  CubeMX, CubeIDE, etc.  Pull up one of the demos and explore everything.  Pull up the CubeMX configuration and go through all the windows.  See what stuff does and what the options are.  If you don't know what something done, look it up.  Run the demo on a board and change stuff.  Make the timer blink the LED faster and slower.  See how the HAL functions are called.  If you get ambitious, dig into the HAL functions and see how the HAL is talking to the hardware.  Remember, you can almost always make things faster if you skip the HAL and go straight to the hardware but that's not always necessary so don't sweat it unless it's important.

Build on a project piece by piece.  Get the LED blinking.  Add UART communications.  Trigger some GPIO interrupts.  There should be demos for all that stuff. 

One more thing:  Use C.  If your embedded system needs stuff like c++ template functions and ploymorphism and it's not a Cortex-A7 or some such mini computer, you are probably using the wrong processor platform.

 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Book/learning material: Any advice for beginners?
« Reply #12 on: February 09, 2023, 12:21:09 am »
> You can't really say "go learn how to configure everything at the register level!  Wizards and HALs are cheating!" if they have no idea what a timer is (I mean you can, but then you are just being difficult).

If you don't know what a timer is, then go and learn that. Wizards and HALs won't teach you that. And then come back and configure everything at the register level.

JW
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Not An Expert
Re: Book/learning material: Any advice for beginners?
« Reply #13 on: February 09, 2023, 12:47:53 am »
> You can't really say "go learn how to configure everything at the register level!  Wizards and HALs are cheating!" if they have no idea what a timer is (I mean you can, but then you are just being difficult).

If you don't know what a timer is, then go and learn that. Wizards and HALs won't teach you that. And then come back and configure everything at the register level.

JW

And while you are at it, get off my lawn! :)
 

Offline julian1

  • Frequent Contributor
  • **
  • Posts: 721
  • Country: au
Re: Book/learning material: Any advice for beginners?
« Reply #14 on: February 09, 2023, 02:01:20 am »
I like the book  Beginning STM32 Developing with FreeRTOS, libopencm3 and GCC, by Warren Gay. The author is a former linux kernel developer.

If you have c/c++ experience, then have a look at the libopencm3 code on github for interfacing to peripherals. Compare it with the HAL/cube approach and decide on which you prefer.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3623
  • Country: nl
Re: Book/learning material: Any advice for beginners?
« Reply #15 on: February 09, 2023, 06:07:26 am »
The OP expressed a desire to learn about the inner workings of the peripherals in the STM32's and microcontrollers in general.

Learning HAL specific for STM32 does not teach you anything about the actual inner workings, just how to make use of them on a simplified level, but simple it ain't, because you have to learn HAL, which is also wading through a lot of information. And diving into the shit pool of code that lies beneath it, is something I would not advice to a beginner. Don't know about the state of it at present, but the view times I tried to use it for something more exotic, it failed for what ever reason.

You can argue that register level is much more difficult, but that depends on how you can pick up on things. Some people will never learn how to use either. And with HAL you still have to know about the settings, because you have to provide them there too. Either way it is not rocket science.

To get a better understanding of the inner workings forget about software. Study hardware, because that is what it is. A timer is a piece of configurable hardware. A serial interface is a piece of configurable hardware. The registers are the interface with the software.

With the nucleo boards the OP has, a lot of fun can be have with.  :-+

Online tellurium

  • Regular Contributor
  • *
  • Posts: 226
  • Country: ua
Re: Book/learning material: Any advice for beginners?
« Reply #16 on: February 09, 2023, 08:50:15 pm »
My (biased) recommendation would be my https://github.com/cpq/bare-metal-programming-guide which covers Nucleo-F429ZI and more
Open source embedded network library https://mongoose.ws
TCP/IP stack + TLS1.3 + HTTP/WebSocket/MQTT in a single file
 
The following users thanked this post: Watth


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf