Skip to main content
rileyrg
Associate II
Sep 25, 2021 3:09 PM UTC
Solved

Absolute noob: how to determine the pin that the LED is on in the IDE?

I'm using a Nucleo -64 stm32f030r8 board.

I've looked at various "blinky" tutorials and they all seem to just pick a a pin out of the air as the LED pin and then flash it through HAL_Toggle_Pin. I have the datasheet for the device but I seem to be blind, stupid and/or a combination of the two.

Can some kind soul step me through the "process" you use to determine which pin ld2 (the green led) is on? I created an stm32 project from the IDE wizard selecting the correct board but no pin is assigned as default as the LED. I can compile, upload and debug etc, it's just me not being able to figure out the LED assignment. Something very obvious I'm sure!

(as a side note, the IDE runs really poorly on my Debian testing desktop and frequently crashes but I can cope with that for now).

This topic has been closed for replies.
rileyrg
rileyrgBest answer
Associate II
Sep 25, 2021 3:13 PM UTC

And 3s after I post, at my wits end, I discover the answer. I had created a project for the MCU not the board. Selecting from the board selection dialog sorted this out! So, minus several million points for me....

3 replies

rileyrg
rileyrgAuthorBest answer
Associate II
Sep 25, 2021 3:13 PM UTC

And 3s after I post, at my wits end, I discover the answer. I had created a project for the MCU not the board. Selecting from the board selection dialog sorted this out! So, minus several million points for me....

TDK
Sep 25, 2021 3:31 PM UTC

The user manual for the board will also contain this information.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Visitor II
Aug 3, 2024 3:42 AM UTC

To expand on TDK's answer:

In the User Manual there is a section usually titled "Hardware layout and configuration" and if your board has built-in LED's there is a subsection titled "LEDs".

I have 2+ boards with built-in LEDs and both user manuals had this convention but your mileage may vary.

In the "LEDs" subsection there will be information which includes the LED numbers, usually in form LD#. Beside the LED number will be a signal number possibly (which you should note down) and a pin number, such as PB4. The pin number requires some decoding; for a pin number PB4, the pin number is 4 on GPIO B.

If the user manual is for multiple board models, as it is for the Nucleo-64 boards, there may be a table of pin, signal, and function correspondences. The signal number you noted should help verify that the pin number corresponds to the correct signal for targeting the LED.