1 week, 6 days ago.

STM32 F411RE Nucleo HAL driver

I am looking for a full example of how to blink an led on the STM32 F411RE Nucleo using the HAL driver. How to compile and flash. I can do this using the mbed api but I want to use pure C. I was using the mbed-cli to compile but I guess this won't work for the HAL drivers.

Comment on this question

2 Answers

1 week, 6 days ago.

Hi, Have you downloaded ST's CubeMX software? It configures the hardware based on your settings. All configuration software is written in C so it would fit your requirement. From CubeMX you export the code and it can be compiled on a number of toolchains. I have not tried importing into mbed online as it does not make sense to do so. However, with GCC and IAR it works great. I believe there are additional examples that are downloaded with the Mx software as well that could get you started for what you are trying to achieve. You might want to contact your local ST rep for more support.

1 week, 5 days ago.

mbed for STM32 targets also uses STM HAL in the backgound. You can check it in the repository.

In CubeMX, you have to configure the pin (eg PC13) to output. After generating code, insert gpio toggle code, see below. Compile with ARM-GCC, upload to MCU, LED blinks. :-)

int main()
    HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);

To post an answer, please log in.