5 years, 10 months ago.

Accessing individuals pins on the chip, not the arduino/morpho pins?

How would i go about telling a specific GPIO pin, say (for example pin 23) to be an output and to toggle itself on and off every half second? I cant seem to find a way to access individual pins on the chip in this manner. I don't want to use the arduino/morpho headers, I want to use the individual pins on the chip itself.

Question relating to:

STM32 Nucleo-64 development board with STM32L433RC MCU, SMPS, supports Arduino, ST Zio and morpho connectivity

1 Answer

5 years, 10 months ago.

Internally the MCU doesn't know or care where a pin physically is, the same logical function can be on different pin numbers depending on the physical package the chip is in. For this reason pin access is normally done by the logical port names (e.g. PA_1 is the first pin in IO bank A) rather than the pin number, this way the same functions are on the same pins for all package types. Where the pin physically is then becomes the hardware engineers problem not the firmware engineers.

If you need to convert between physical pin numbers and logical pin numbers you can either look at the datasheet , page 58, the LQFP64 package or Page 61 onwards, Table 15) or you look at the board schematic here .

You can always #define the pin numbers to pin names if you want e.g.

#define pin2 PC_13

which is how the arduino header IDs are mapped to the physical pins.

Accepted Answer

What about pins that are in the data sheet that don't show up in the "PinNames.h" file? Such as PC13. Should I just include them manually in "PinNames.h"?

posted by Benjamin Spooner 11 Jun 2018

The other thing to look out for are other uses on those pins that may not be immediately obvious e.g. PC_13 is used for the user button.

posted by Andy A 11 Jun 2018

I found that I was using the 432 folders, not the 433 folders. Now I should be able to find all the pins. Thank you so much!

posted by Benjamin Spooner 11 Jun 2018

Again, thank you for all of your help

posted by Benjamin Spooner 14 Jun 2018