8 years, 3 months ago.

PIN NAMES and pin number

soo,... i'm sorry i'm still beginner here,so i got confused. my microcontroller is STM32F446RE which means i have 64 configured pin. but i'm still confused, is there no sign or something which one is pin.0 or pin.63? where should i started count those pin?

i just want to use something like GPIO, err... just simple output which i planned to make something like running led. could someone tell me how to do it? because there's just library for DigitalOut (pinNames) and i so confused which name in which pin i should pair with my led.

thankyou for responding

Question relating to:

Fork of the official mbed C/C++ SDK provides the software platform and libraries to build your applications. The fork has the documentation converted to Doxygen format

2 Answers

8 years, 3 months ago.

Hello Adhelia. Please review the following landing page for your STM32F44RE Nucleo board:

http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF262063

Review the schematics for your Nucleo board from the following link:

http://www.st.com/st-web-ui/static/active/en/resource/technical/layouts_and_diagrams/schematic_pack/nucleo_64pins_sch.zip

Also suggest to review this quick summary of the pins available through the Nucleo board with your CPU:

https://developer.mbed.org/platforms/ST-Nucleo-F446RE/

Then review the many examples on this website including the COOKBOOK and HANDBOOK webpages at the top of this website to assist you in learning quickly about the benefits of MBED.

You can review the Nucleo board details and assign a pin to be an output using the respective port pin name.

For example, IMPORT this quick demo (use the BLUE BUTTON on the right side of the screen once you land on the following webpage to import the quick demo into your cloud space account with MBED):

https://developer.mbed.org/teams/mbed/code/mbed_blinky/

By default, if you select the target NUCLEO board that you presently own, the LED1 value will automatically map to a working LED supplied with your kit. It is that simple to get started. Be sure to select the MBED library inside this imported program and the select UPDATE using the right side of your compiler. This is important to be sure you upgrade to the latest library by MBED.

Next, let us say you wish to change the LED1 pin to your custom defined port pin. How and which ?

How, replace the LED1 value with a port pin that you wish to use from the NUCLEO MBED page for your target board:

https://developer.mbed.org/platforms/ST-Nucleo-F446RE/

for example, try:

DigitalOut myled(PC_8);  // attach a LED with a current limit resistor of 390 ohms or higher to the noted pin on NUCLEO

// connect the ANODE (positive / long lead of the LED) to PC_8 and the CATHODE (negative / short lead) to ground
// with this wiring when PC_8 = 1, you are applying +3.3 volts onto PC_8 which will then turn the LED ON and if 0, LED will be 
// OFF
// you could also reverse the LED and connect the ANODE to your local +3.3 volts but then to turn the LED ON, you will need 
// to output a 0

Compile -> drag & drop the binary onto the target drive letter. This should now flash the PC_8 pin on your Nucleo board.

Do try the example and notes and certainly post back if you have any issues. Soon you will learn how easily MBED shelters us from the many lines of complex code to achieve the desired tasks.

The use of such port pins as I/O (Input / Output) is very straightforward using the MBED library. Do respective the max voltage ranges (most pins are 5 volt tolerant but play it safe and consider to use 0 to +3V3 for most of your experiments. If you wish to use say SPI or I2C interfaces then you are required to use only the pins shown in the datasheet for your NUCLEO board so that the compiler can arrange the requested hardware functions onto the specific pins - that is mandatory.

Experiment away, learn and Enjoy !!

Accepted Answer
8 years, 3 months ago.

The short version: The GPIO pins aren't numbered 1-64, they are named after the CPU IO port that they are controlled by e.g. PA_5 is pin 5 on port A. This means that physical pin location may not be related to pin name. Which pin is where is shown on this page. All pins can be used as GPIO, a lot of them also have alternative functions as indicated on those diagrams.