Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.

Nucleo Pinmap to Micro Pinout Diagram

20 Mar 2014

I have found the pin map here for the Nucleo F401, but I noticed the very first program I loaded refers to the pins in terms of which pin to the micro the connections should be made.

Does anybody have any sort of map depicting the breakout from which pins of the Micro going to which pins of the headers?

Thanks,

-Matt

20 Mar 2014

The diagram here gives you the port identification and the corresponding breakout pin. That is usually all you need for the software side of things. The wiring to the physical pins is provided in the ST manual by looking up the schematic here.

26 Mar 2014

about the ST Nucleo (et.al.) from an inexperienced mbed user...(but been around a schematic once or twice).

couldn't the pins be grouped in a "pretty" port sequential format, PA_0-15 in a row kinda thing?

i understand the port.pins jump around the chip (why/how do they do that at the silicon level?), even more so across different packages (ok, wirebonding issues) and that i should just virtualize the physical world, but my brain, eyes, fingers, cables and scope are (anciently) constrained in simple lineal axes.

it sure would make debugging and signal integrity, well, just easy.

and if ARM or ST or NXP are reading, how about a tighter grouping of secondary/tertiary functions within ports, leaving at least one wide port* for high speed transfers...?

"kick the soap box out now"

-peter.

  • without going to outrageously big packages.
26 Mar 2014

Very valid point. I am still having trouble understanding the mbed platform. I cannot seem to find any syntax references, and the major is that I receive errors on pre written programs that I literally haven't changed anything.

I just want to define output pins, plain and simple. I purely want to blink an LED...which is one of the easiest tasks accomplish able on the arduino, yet this platform is much more complicated. I have loaded the app-board RGB program and attempted to compile without modifying at all - which as results in numerous errors.

Firstly, pins 23, 24, and 25 - is not clear to which pin of which IC these connections are to be made. When you highlight the text "p23" that is defining this pin as the output pin for the variable R which will be our red value, it highlights a box on the right side saying p23 = p1_17....which leads me to absolutely nowhere. My thinking was, if I compile the program, and try each morpho pin connector - I may be able to identify which pins are defined and from there decipher this syntax.

Only problem is, cannot compile the program because pins 23, 24, and 25 are not defined. I receive errors, suggesting the program was written for another micro, not the nucleo f401re's micro that I am attempting to learn.

So, how do I define the outputs of the nucleo 401re's micro?

Also, what do these errors mean?

Error: Function "time(std::time_t *)" conflicts with using-declaration of function "std::time(std::time_t *)" in "mbed-src/common/rtc_time.c", Line: 28, Col: 8

Error: Function "clock()" conflicts with using-declaration of function "std::clock()" in "mbed-src/common/rtc_time.c", Line: 55, Col: 9

26 Mar 2014

The issue is that you are looking at the completely wrong code. If you start at your platforms page: https://mbed.org/platforms/ST-Nucleo-F401RE/, you have at the right side a long list of example programs. Otherwise if you make a new program in the compiler, it will ask you if you just want a default blink program.

The only reason Arduino might be easier is because the pinout is a bit more standardised, while mbed uses alot of different platforms, with different pinouts. But as someone who uses both, imo mbed really isn't more complicated, just a bit different on a few things, and on a few things significantly easier.

Now you are currently looking at the application board, which is: http://mbed.org/cookbook/mbed-application-board. This is designed for the LPC1768, which is: http://mbed.org/platforms/mbed-LPC1768/. And there you see those pinouts make alot of sense.

You have the F401, which has its pinout here: https://mbed.org/platforms/ST-Nucleo-F401RE/. And looking at the picture at least the Arduino pinout is also included on the PCB itself. You can use both the pinouts in the blue boxes, and those in the green boxes (Arduino pinout), they are both defined. I don't know if the LEDs itself are capable of PWM control directly on the Nucleo board. PWM_OUT in the pwm example is PB_3, I have to admit I don't have a clue why STM defined it as that one and not just PB_3. I quickly checked the source code, since I don't have the Nucleo myself, but I *think* the LED should also work for PWM.

Regarding those errors, not a clue, but most likely related to an old library.

27 Mar 2014

No unfortunately the LED is not mapped on a "PWM capable" IO. You can see it on the pinout that the LED is on PA_5.

In our examples we prefer to use the naming PWM_OUT (or other common names) instead of the real pin name because the example can be directly used on any Nucleo board without changing them.

Regards.

27 Mar 2014

Two things: First of all, I don't have it myself, so is it in the documentation with it anywhere mentioned what PWM_OUT is? I understand the logic behind it, but then it should be mentioned somewhere which pin it is. If it is for every board the same Arduino pin that might be even clearer. But if you have to look up the source files which pin is actually PWM_OUT then that isn't really handy.

Second, from the pwm api file:

static const PinMap PinMap_PWM[] = {
    {PA_0,  PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2)}, // TIM2_CH1
  //{PA_0,  PWM_5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5)}, // TIM5_CH1
    {PA_1,  PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2)}, // TIM2_CH2
  //{PA_1,  PWM_5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5)}, // TIM5_CH2
    {PA_2,  PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2)}, // TIM2_CH3
  //{PA_2,  PWM_5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5)}, // TIM5_CH3
  //{PA_2,  PWM_9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9)}, // TIM9_CH1
    {PA_3,  PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2)}, // TIM2_CH3
  //{PA_3,  PWM_5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5)}, // TIM5_CH4
  //{PA_3,  PWM_9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9)}, // TIM9_CH2
    {PA_5,  PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2)}, // TIM2_CH1
    {PA_6,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)}, // TIM3_CH1
    {PA_7,  PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)}, // TIM1_CH1N
  //{PA_7,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)}, // TIM3_CH2
    {PA_8,  PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)}, // TIM1_CH1
    {PA_9,  PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)}, // TIM1_CH2
    {PA_10, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)}, // TIM1_CH3
    {PA_11, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)}, // TIM1_CH4
    {PA_15, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2)}, // TIM2_CH1
 
    {PB_0,  PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)},  // TIM1_CH2N
  //{PB_0,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)},  // TIM3_CH3   
    {PB_1,  PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)},  // TIM1_CH3N
  //{PB_1,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)},  // TIM3_CH4      
    {PB_3,  PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2)},  // TIM2_CH2
    {PB_4,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)},  // TIM3_CH1
    {PB_5,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)},  // TIM3_CH2
    {PB_6,  PWM_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4)},  // TIM4_CH1
    {PB_7,  PWM_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4)},  // TIM4_CH2
    {PB_8,  PWM_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4)},  // TIM4_CH3
  //{PB_8,  PWM_10,STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10)}, // TIM10_CH1    
    {PB_9,  PWM_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4)},  // TIM4_CH4
  //{PB_9,  PWM_11,STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11)}, // TIM11_CH1        
    {PB_10, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2)},  // TIM2_CH3
    {PB_13, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)},  // TIM1_CH1N
    {PB_14, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)},  // TIM1_CH2N
    {PB_15, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1)},  // TIM1_CH3N
    
    {PC_6,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)},  // TIM3_CH1
    {PC_7,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)},  // TIM3_CH2
    {PC_8,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)},  // TIM3_CH3
    {PC_9,  PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3)},  // TIM3_CH3
    
    {NC,    NC,    0}
};

PA_5 is listed there.

27 Mar 2014

Let me see if I understand this correctly. When using the mbed compiler, you can use any of the reference designators provided, for example: sck, pa_5, and d13 are all the same pin. You have the choice for which reference designator to use for defining this pin?

I see the enumerator appears when selecting the defined pins, for example: d5 = pb_4. Does this mean I can define with with either "enumerators" provided because they reference the same pin?

27 Mar 2014

Do watch that they letters are capital, but yes. One pin can be addressed with several names. For every platform at least the 'original' pin names are available. Then for all with Arduino pinouts, which include the Nucleo, also the Arduino pinnames are available, and some also have some others defined. PA_5 is for example also the LED, the SPI_SCK (apparantly same as LED, so your LED always flashes when using SPI, and you can't use both at the same time), and D13.

Here is the complete pin definition for the F401: http://mbed.org/users/mbed_official/code/mbed-src/file/e3413eddde57/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/PinNames.h

27 Mar 2014

Erik, you are right for PA_5. This pin can output a PWM signal. I have checked the wrong pinout...

Concerning the signals which are not in the pinout picture like PWM_OUT, I will try to add them in a text note before the picture pinout.

Regards.

27 Mar 2014

Thank you guys for sharing your knowledge with me. I must admit, I feel ashamed I had as much trouble as I did. I see where my mistakes were now, and believe I am understanding mbed and the f401re much more clearly now. Thank you for bearing with my awfully amateur questions.

This is my first go at STMs micros. I have used the vipre buck converters on numerous builds, and was so pleased with the performance that it inspired me to learn some of their micro products.

Thank you again as I am excited to begin implementing the F401RE into my current build.

23 May 2014

Hello and thanks for all of this information.

I have a follow up question.

How do I deal with a signal available on multiple pins? For instance, spi1 miso is shown on pins PA_7 and PB_5.

When creating my spi object, do I need to always use the mosi, miso, and clock that appear in the same block I.e. PA_5 6 and 7 always together.

Thanks for your help, Laz

25 May 2014

Hello,

The "only" thing to take care about is that the MOSI, MISO, SCLK, SSEL pins belong to the same SPI (SPI1, SPI2, ...). If several MISO pins of SPI1 are available you can take anyone of those. But you cannot use MISO of SPI1 and MOSI of SPI2 for example.

Regards.

Please log in to post a reply.