0
\$\begingroup\$

I'm using this MCU from STM2 on a board and the PCB layout is as follows:

enter image description here

I will not use several MCU pins, so they are disconnected as shown above(pin 6, 7, 8, 11, 12 ect.). Also I cannot do any physical change anymore because already ordered the board.

But later, I was wondering about how to treat these unused MCU pins. I came over this question.

In my case, I use STM32CubeIDE to set GPIOs and unused pins are shown in grey colour and when I hover on them it says "Reset_State" as shown below:

enter image description here

I don't know what "Reset_State" does to the pin. What would be the best option to avoid an issue such as EMI in my case? Should I set them as GPIO input or leave as Reset-State in software before flashing?

(As I mentioned I cannot make any physical change to the board.)

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

The answer is in the data sheet page 62.

It says to avoid current consumption of floating IO pins, they must be configured as analog pins, or forced to some value by using internal pull-ups or pull-downs (does not matter which one) or configuring the pin as output (high or low, does not matter).

In the reset state (i.e. default, left unconfigured), the pins are on this MCU configured as digital IO pins.

You need to define them as analog mode, digital inputs with pull resistor, or define them as outputs.

\$\endgroup\$
5
  • \$\begingroup\$ Very helpful and thorough answer. Thanks! \$\endgroup\$
    – pnatk
    Commented Jul 13 at 23:30
  • \$\begingroup\$ "They default to being analog pins."--not according to this,Page 35, Table 12, Notes, indicates that. "Unless otherwise specified by a note, all I/Os are set as floating inputs during and after reset" So not analog inputs out of reset. \$\endgroup\$
    – user319836
    Commented Jul 14 at 12:16
  • \$\begingroup\$ @RussellH So better to set the unused pins as GPIO inputs with pull-down resistors? \$\endgroup\$
    – pnatk
    Commented Jul 16 at 13:48
  • \$\begingroup\$ I would monitor the supply current and test for lowest current consumption. I just know that floating inputs are undesirable. \$\endgroup\$
    – user319836
    Commented Jul 16 at 17:59
  • \$\begingroup\$ @pnatk Datasheet is still correct. The pins just need to be configured from the default/reset state to either analog mode, or input with any pull direction, or output that pushes into any state. \$\endgroup\$
    – Justme
    Commented Jul 16 at 18:02
0
\$\begingroup\$

In the case of GPIOs if you want to be sure you know the state of each, you can assign them an internal pull up/down resistor. External components are not needed, the MCU has an internal function to pull the signal to each rail.

Hard wiring them to ground I wouldn't advice during development phase, as a problem in code might break the MCU. That would happen in the cases where you assign the pin to another state than what you hard wired it.

The Stm32CubeMX tool displays "Reset_State", meaning that the user has not specified anything for the pin, so it is in the default reset state in the initialization routine. Clicking it removes the configuration that was selected:

Before clicking the pin was configured for UART:

Before clicking

After clicking Reset_State the selection is removed:

After clicking

\$\endgroup\$
11
  • \$\begingroup\$ I cannot make any physical change to the board. I mentioned this in question 2 times. \$\endgroup\$
    – pnatk
    Commented Jul 13 at 19:12
  • \$\begingroup\$ I'll try to re-phrase to make it clear. I meant pulls internal to the MCU. \$\endgroup\$
    – Ralph
    Commented Jul 13 at 19:14
  • \$\begingroup\$ I was thinking to set unused pins as GPIOs and as inputs with pull down resistors. Why pullup? \$\endgroup\$
    – pnatk
    Commented Jul 13 at 19:14
  • \$\begingroup\$ In some stm32 families the pull down consumes less power. I would guess the f3 is the same, so there's no reason to use a pull-up, it's just an option. \$\endgroup\$
    – Ralph
    Commented Jul 13 at 19:19
  • 1
    \$\begingroup\$ @RussellH I double checked and I have been wrong for all these years. At least this specific MCU at reset state sets pins into digital input mode, not analog mode, which is a bit stupid because you can't even read the pins until you enable peripheral clocks to the GPIO ports. I will edit my answer with the info. \$\endgroup\$
    – Justme
    Commented Jul 14 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.