Skip to main content
Md Mubdiul Hasan
Associate III
September 7, 2024
Solved

For better learning STM32 programming and debugging

  • September 7, 2024
  • 5 replies
  • 4761 views

Hi there,

I have been using STM32 nearly 10 years.

I did modification according to company requirements. But it doesn't mean I am very good at C,C++ or else. I understand coding if it'd in C or C++ format. 

 

I understand mathematics, logics and conditioning.

 

Kindly suggest materials/ guidelines/ books/ tutorials that might help me to write coding/ debugging and finding root cause of failure.

Let's say staring with ARM cortex type M0. 

 

Best answer by Andrew Neil

@Md Mubdiul Hasan wrote:

Kindly suggest materials/ guidelines/ books/ tutorials that might help me to write coding/ debugging and finding root cause of failure.


98% of this is not specific to the particular microcontroller - these are general, transferrable skills.

Most of it is down to being able to analyse a problem and define a solution.

But here are some links to ST's own learning & reference materials

https://community.st.com/t5/stm32cubeide-mcus/how-to-start-with-stm32/m-p/185269/highlight/true#M8564

https://community.st.com/t5/feedback-forum/1st-time-in-the-forum-hello-to-all/m-p/657526/highlight/true#M1205

https://community.st.com/t5/learning/ct-p/Learning

ST's YouTube channel: https://www.youtube.com/results?search_query=stmicroelectronics 

 


@Md Mubdiul Hasan wrote:

Kindly send link only for STM32.


You can't be so narrow. You need the general topics like the Cortex-M0 architecture, general electronics, and general C programming.

For understanding the Cortex-M architectures, Joseph Yiu's Definitive Guide books are required reading:

https://www.amazon.co.uk/Books-Joseph-Yiu/s?rh=n%3A266239%2Cp_27%3AJoseph+Yiu

For understanding the STM32, the device Datasheet and Reference Manual are key documents - you will find these and much more on the Product Page for the chip in question.

 

Some general tips on How To Debug:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/706966/highlight/true#M49

Specifically on debugging Cortex-M Hard Faults:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/708193/highlight/true#M51

 

Some learning & reference materials for C programming:

https://blog.antronics.co.uk/2011/08/08/so-youre-thinking-of-starting-with-c/

 

Some more learning & reference materials applicable to embedded microcontrollers:

https://www.avrfreaks.net/s/topic/a5C3l000000UYGFEA4/t145493?comment=P-1392529

 

Another important skill is How To Read Compiler Error Messages:

https://community.st.com/t5/stm32cubeide-mcus/type-missing-binary-operator-before-token-quot-quot/m-p/719446/highlight/true#M30606

 

#GettingStarted

5 replies

STTwo-32
ST Technical Moderator
September 7, 2024

Hello @Md Mubdiul Hasan 

For the cortex-M0, i may suggest you the documents available on this link. Also, you can check our progarmming manuals for devices using cortex-M0 et Cotex-M0+ . Also, i may suggest you to contact ARM throw there community or to try there online trainings.

Best Regards.

STTwo-32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Md Mubdiul Hasan
Associate III
September 7, 2024

Thank you.

Kindly send link only for STM32.

mƎALLEm
ST Technical Moderator
September 7, 2024
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Md Mubdiul Hasan
Associate III
September 12, 2024

Can you suggest very good books?

Andrew Neil
Andrew NeilBest answer
Super User
September 12, 2024

@Md Mubdiul Hasan wrote:

Kindly suggest materials/ guidelines/ books/ tutorials that might help me to write coding/ debugging and finding root cause of failure.


98% of this is not specific to the particular microcontroller - these are general, transferrable skills.

Most of it is down to being able to analyse a problem and define a solution.

But here are some links to ST's own learning & reference materials

https://community.st.com/t5/stm32cubeide-mcus/how-to-start-with-stm32/m-p/185269/highlight/true#M8564

https://community.st.com/t5/feedback-forum/1st-time-in-the-forum-hello-to-all/m-p/657526/highlight/true#M1205

https://community.st.com/t5/learning/ct-p/Learning

ST's YouTube channel: https://www.youtube.com/results?search_query=stmicroelectronics 

 


@Md Mubdiul Hasan wrote:

Kindly send link only for STM32.


You can't be so narrow. You need the general topics like the Cortex-M0 architecture, general electronics, and general C programming.

For understanding the Cortex-M architectures, Joseph Yiu's Definitive Guide books are required reading:

https://www.amazon.co.uk/Books-Joseph-Yiu/s?rh=n%3A266239%2Cp_27%3AJoseph+Yiu

For understanding the STM32, the device Datasheet and Reference Manual are key documents - you will find these and much more on the Product Page for the chip in question.

 

Some general tips on How To Debug:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/706966/highlight/true#M49

Specifically on debugging Cortex-M Hard Faults:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/708193/highlight/true#M51

 

Some learning & reference materials for C programming:

https://blog.antronics.co.uk/2011/08/08/so-youre-thinking-of-starting-with-c/

 

Some more learning & reference materials applicable to embedded microcontrollers:

https://www.avrfreaks.net/s/topic/a5C3l000000UYGFEA4/t145493?comment=P-1392529

 

Another important skill is How To Read Compiler Error Messages:

https://community.st.com/t5/stm32cubeide-mcus/type-missing-binary-operator-before-token-quot-quot/m-p/719446/highlight/true#M30606

 

#GettingStarted

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.
Md Mubdiul Hasan
Associate III
September 12, 2024

Andrew,

Your suggestions looks suitable.

I have few different STM32 board to play with.

Let's try your materials.

LCE
Principal II
September 12, 2024

Reading helps, but I recommend doing that in parallel with working / playing with some real programming environment and hardware.

So get a Nucleo board, install STM32CubeIDE - and just do it!

Andrew Neil
Super User
September 12, 2024

@LCE wrote:

So get a Nucleo board, install STM32CubeIDE - and just do it!


:thumbs_up:Indeed! :ok_hand:

Don't waste time with a blue/black/whatever pill - get a genuine ST Nucleo, which includes a genuine ST-Link, has a load of ready-to-use examples, and is well-known and well-supported by both ST and this community.

Getting Started steps:

  1. Write some code to blink an LED connected to a pin, using a simple software loop.
  2. Learn how to use your debugger to step through your simple LED code, look at your variables, set breakpoints, etc 
  3. Learn to use the UART to transmit a fixed "Hello, World " string.
    Again, 
    practice using the debugger with it.
  4. Adapt your code to be able to send a variable string.
    This will be invaluable for future work! 
    Keep practicing with that debugger...
  5. Adapt your code to be able to receive on the UART
  6. By now, you should be well prepared not only to write your own code, but also to debug it.

(From an original post here, but the formatting there seems to have got corrupted)

 

PS:

Applying the above to a specific project:

https://community.st.com/t5/stm32-mcus-boards-and-hardware/connection-between-2-stm32-mcu-boards-using-uart-with-only-one/m-p/719885/highlight/true#M21355

 

#BeginnerGettingStarted

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.
Tesla DeLorean
Guru
September 12, 2024

>>I have been using STM32 nearly 10 years

>>>Kindly send link only for STM32.

This does kind of trouble me, that in this time you've not got a clearer path forward, and got some rather fixed and narrow thought processes.

Perhaps a "Learning how to learn" course might be something to consider?

Now we all approach these things differently, I tend to approach via inference and triangulation, as Andrew indicates a lot of the technical details between MCUs is highly transferable, most being more the same than different. Triangulation would be to get information from multiple perspectives, say multiple texts about materially the same thing, but with different approaches and view-points that different authors and use-cases bring.

The internet opens the door to be able to find a lot of material, but you need to filter and focus that.

Do thing incrementally, there's not going to be a mind-melding approach where you're going to get to understand all the details all a once.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..