Nucleo-F030R8 Hardware SPI Pins

All about boards manufactured by ST
User avatar
fpiSTM
Posts: 1745
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Nucleo-F030R8 Hardware SPI Pins

Post by fpiSTM »

If it was D12 you could not use analog API. This allows to resolve which pin you used and for what.
PYn, Dx, x and Ax are simply an index to find the PinName PY_n in the digital array available in the variant.cpp. PinName is a conbination of GPIO port and pin. That's all. So, don't figured out anything, it respects the standard naming under the hood.😉
GeorgeIoak
Posts: 39
Joined: Sun Jun 07, 2020 2:01 am

Re: Nucleo-F030R8 Hardware SPI Pins

Post by GeorgeIoak »

OK, thanks again, I didn't realize that if it was defined as a digital pin you couldn't change the definition to an analog input (not sure why but I'm sure there's a good reason). ;)

So

PeripheralPins.c defines all the pin's possible functions (AKA alternate mode listed in the datasheet)
variant.cpp lists all the digital pins then analog pins in order, D0-Dx and A0-Ax
variant.h assigns Arduino naming to STM32 datasheet port/pin names

If I'm looking at a schematic of a board and I don't care about Arduino names I could just use "STM32 names" and be fine, right?

The only missing piece (for me) is how do you know what functions are assigned to pins? PeripheralPins.c lists all the possible choices but I don't see where I would know what pins are used for I2C, UART, or SPI if I'm using a library that just "assumes" you have standard Arduino mapping.
User avatar
fpiSTM
Posts: 1745
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Nucleo-F030R8 Hardware SPI Pins

Post by fpiSTM »

Like for arduino, there are the default instance which use the defaut pins like for Arduino UNO: D11,D12,D13 for SPI, D14, D15 fore Wire.
Post Reply

Return to “STM boards (Discovery, Eval, Nucleo, ...)”