January 11, 2024

STM32CubeMX - "hello world"

I would be quite happy to achieve the "hello world" milestone with my H747 board and STM32CubeMX. This would tell me that I had clocks set up right, and the uart initializaed. With the built in ST-Link/V3 virtual console port via USB, it ought to be trivial to see whatever messages I could generate.

I am pleased to discover that other people have had much the same idea, albeit with other hardware:

With the ST Nucleo 64

This dates from May, 2021.

She uses a STM32 nucleo 64, which has a STM32L412 and onboard ST-Link/V2. These are currently available for about $10. She uses both STM32CubeMX and STM32CubeIDE. She actually doesn't do anything with uart messages, but blinks an external LED. However, she makes CubeMX do all the hard work and just uses CubeIDE to add a small bit of code to main.c (and to compile the whole mess)

He only adds a tiny bit of code to main.c, as follows:

    #define LED_PIN GPIO_PIN_5

    while ( 1 ) {
	HAL_GPIO_WritePin(GPIOA, LED_PIN, GPIO_PIN_SET);
	HAL_Delay(200);
	HAL_GPIO_WritePin(GPIOA, LED_PIN, GPIO_PIN_RESET);
	HAL_Delay(200);
    }

Hello with the serial port

From the ST Wiki, some examples using Nucleo boards and Cube:

PoMAD stm32 tutorials

Here we have a fellow in France who is publishing nice STM32 tutorial (in English!).
Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org