2020-09-09 05:40 AM
It is recomanded to set unused pins to analog input.
Solved! Go to Solution.
2020-09-09 09:38 AM
In STM32L0xx, pins are set to Analog by default after reset, you don't need to do anything else. See GPIOx_MODER description in GPIO chapter of the RM.
JW
2020-09-09 06:48 AM
Which STM32?
If those which don't have this by default after reset, maybe the easiest is to set all fields in GPIOx_MODER to Analog for all GPIOx, before any other GPIO setup. Of course, the GPIOx clocks have to be enabled in RCC before that. Make sure the SWD pins are not changed, if debugging ought to remain usable.
JW
2020-09-09 07:07 AM
@Community member Thanks for the answer. I am using STM32L072RZ.
If I want to set all the 16 pins for port A to analog input is this possible to do in this way:
GPIOA->MODER = GPIO_MODE_ANALOG;
2020-09-09 09:38 AM
In STM32L0xx, pins are set to Analog by default after reset, you don't need to do anything else. See GPIOx_MODER description in GPIO chapter of the RM.
JW