2023-08-14 03:28 AM
Dear ST Community members
I am currently designing a PCB and utilizing the STM32G473VET6 MCU. I have noticed that there are several unused pins. Should I leave these pins unconnected or is there a recommended course of action for dealing with them?
thanks and regards
Neeraj
Solved! Go to Solution.
2023-10-13 02:22 AM
Dear Peter BENSCH,
For me one is still not clearly. Why you wrote that:
@Peter BENSCH wrote:
Connecting the pin directly to GND is, as already discussed, not a good idea.
Could you write more about why do not connect the pin directly to GND, and where this was discussed ?
Regards falaat
2023-10-16 12:50 AM
Initially, you had only spoken in general terms about unused pins, to which there were some references (e.g. @KnarfB, @KDJEM.1 or @TDK) and to which my statement essentially referred. A pull resistor also has a current-limiting protective function in case an output function is accidentally activated at the GPIO in question. In your case, if you make sure that PA1 is not programmed as an output, you can also connect PA1 directly to GND.
Regards
/Peter
2023-11-17 11:46 PM - edited 2023-11-17 11:57 PM
Why is it important to tie unused pins to a PU or PD? Can't you just initialize those pins immediately following reset to PP outputs? Doing that, wouldn't the only time they float be when the MCU is in reset and just before they get configured?
Is there a problem with potentially damaging current when a pin is floated?
After all, aren't most intended output pins floating at reset (e.g., pins driving an LED, SPI_MOSI, etc. )?
2023-11-23 11:57 PM
@DavidNaviaux Most pins are GPIO, i.e. internally multiplexed, including MOSI, for example. If you want to drive an LED, you must explicitly set the GPIO to digital output and connect several GPIOs in parallel for higher LED currents (if no external driver is to be used).
In some families, unused pins are connected to the internal Schmitt trigger as digital inputs in the uninitialised state. If such high-impedance pins float, interference pulses from the environment can lead to unwanted switching of the Schmitt trigger, which results in significant operating current, at least with ultra-low power MCUs. In newer families, the GPIOs are therefore set to analogue input by default.
Yes, you can also initialise the pins to PP - but then they are no longer considered uninitialised.
2023-11-24 12:19 AM
I do have a few pins directly connected to low-current LEDs through current limit resistors that will limit the current to a maximum of 6.2mA at the maximum power supply voltage. Although I don't see in the datasheet for the STM32G474 a specification on what the output voltage vs output current is of a GPIO pin, it seems to work very well.
As far as unused pins go, as a general rule, if I have unused pins, I will initialize them in firmware as GPIO low outputs first thing out of reset. Since I do this, I have not generally used PU or PD resistors on those pins. Usually, there are several pins in a design that I must have in a particular state when the MCU is held reset; for those I use an external PU or PD as required (e.g., I don't want an RS485 driver to be on during an MCU reset so use a PD on the DE pin). I have had to deal with a few "gotchas" in that a few pins aren't actually floating during reset, as I was expecting (should have read the datasheet more closely).
Is this practice reasonable for an STM32 design?
2023-11-24 01:14 AM
@DavidNaviaux: Briefly on the output current of the GPIOs on the STM32G474: in its data sheet, section 5.3.14 (I/O port characteristics) you will also find a section Output driving current, which confirms your observation. The GPIOs can certainly drive ±20mA if no defined logic levels are required. However, you must pay attention to the maximum total current.
Anyway, we are deviating from the original question of the TO, so you should open a new thread if a further discussion is necessary.
Regards
/Peter