We are currently using various variants of the STM32 microcontroller family. I would like to know the following:
What are the recommended default settings for pins of the microcontrollers in general if you have the option to select both pull ups or pull downs? What are the pros and cons of going with one or the other? (Assuming you will set them up by default as inputs)
In particular I would like to know what to do with unused pins for the STM32 microcontroller family. It is obvious to me that we should not leave the pins floating, (which is all that the datasheet says, :( ), but should I should set them to input with pull ups or inputs with pull downs? In particular, I would like to choose a setting that is least susceptible to ESD and also if possible, consumes the least amount of power.
For critical pins, should we rely on the firmware to correctly set up the pins to the correct default state or should this responsibility lie with the external hardware (connecting external pull ups or pull downs)? If the values chosen for the external resistors is greater than the internal pull ups or pull downs, the setting in firmware does not matter.
The pro that I can see for doing the above, is that if the micro does not initialise properly for whatever reason (faulty hardware or the likes), we are not relying on the firmware to set up the pin correctly.
The con I see is that it costs more to do this is hardware.
Any light that you can shed on the above will be really appreciated.