2021-09-17 02:05 AM
Hello,
I would like to know, why unconfigured pin is consuming power when it is connected to 3.3 volt, while it is in analog input mode (reset mode as per to the data sheet).
here, what i have tested with three configurations.
with pin configuration(PA8 and PA11) in STM32CubMax
no configuration (Reset mode by itself) - 0.8W (unused pin connected to 3.3)
input mode configuration -0.5W (unused pin connected to 3.3)
input analog configuration -0.5W (unused pin connected to 3.3)
so what makes change in no configuration from STM32CubMAx and analog input(GPIO_MODE_ANALOG) and input(GPIO_MODE_INPUT)
what other parameter internally changes by doing
1.no config (no init code in sw)
2.
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_11;;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
3.
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_11;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
reset by itselt configuration
0x0000000050000000 69EBFFAB «ÿëi
0x0000000050000004 00000000 ....
0x0000000050000008 0C3C00F0 ð.<.
0x000000005000000C 24100000 ...$
0x0000000050000010 0000760C .v..
0x0000000050000014 00001000 ....
0x0000000050000018 00000000 ....
0x000000005000001C 00000000 ....
0x0000000050000020 00004420 D..
0x0000000050000024 00000440 @...
0x0000000050000028 00000000 ....
configuration as input
0x0000000050000000 6928FFAB «ÿ(i
0x0000000050000004 00000000 ....
0x0000000050000008 0C3C00F0 ð.<.
0x000000005000000C 24100000 ...$
0x0000000050000010 00007F0C ....
0x0000000050000014 00001000 ....
0x0000000050000018 00000000 ....
0x000000005000001C 00000000 ....
0x0000000050000020 00004420 D..
0x0000000050000024 00000440 @...
0x0000000050000028 00000000 ....
configuration as analog input
0x0000000050000000 69EBFFAB «ÿëi
0x0000000050000004 00000000 ....
0x0000000050000008 0C3C00F0 ð.<.
0x000000005000000C 24100000 ...$
0x0000000050000010 0000760C .v..
0x0000000050000014 00001000 ....
0x0000000050000018 00000000 ....
0x000000005000001C 00000000 ....
0x0000000050000020 00004420 D..
0x0000000050000024 00000440 @...
0x0000000050000028 00000000 ....
-- input configured 1 10 10 01 00 10 10 00 11 11 11 11 10 10 10 11
-- reset and input analog 1 10 10 01 11 10 10 11 11 11 11 11 10 10 10 11
please share you input, what could be the reason behind change in behavior by making change only in configuration.
Thank you
2021-09-17 03:07 AM
7.6 Unused I/Os and features
All microcontrollers are designed for a variety of applications and often a particular application does not use 100% of the MCU resources. To increase EMC performance and avoid extra power consumption, the unused features of the device should be disabled and disconnected from the clock tree. The unused clock source should be disabled and the unused I/Os should not be left floating. The unused I/O pins should be configured as analog input by software; they should also be connected to a fixed logic level 0 or 1 by an external or internal pull-up or pull-down or configured as output mode using software.
by default it is in analog input
if it is already in reset mode then why have to configure in software? and why it makes a change while configuring in software as analog input then reset state by it self(without software config)?
2021-09-17 05:21 AM
> 0x0000000050000000 69EBFFAB
> 0x0000000050000000 69EBFFAB
If configuration 1 and 3 are identical as far as the GPIO registers, I don't see how there could be a difference in power consumption.
But they're not at the reset values given in the RM, so perhaps you're doing something else in the code that is causing the discrepancy.
In your "configuration as analog input", PA9 is set to AF mode. So something else is going on.
2021-09-17 06:14 AM
yes,1 and 3 identical
But they're not at the reset values given in the RM, so perhaps you're doing something else in the code that is causing the discrepancy.
But if you do not do software based initialization then it is taking analog (11) automatically.
but why 1 consume more power which is default than software based configuration in 3, is there any hidden configuration?
configuration as analog input and reset (no code initilization in sw) are identical
1(no code ) -- 01 10 10 01 11 10 10 11 11 11 11 11 10 10 10 11
2(input code init) -- 01 10 10 01 00 10 10 00 11 11 11 11 10 10 10 11
3(input analog code init )-- 01 10 10 01 11 10 10 11 11 11 11 11 10 10 10 11
and PA9 and PA10 is used as an uart but that are same to all configs. I don't think it has any impact.