cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L031 alternate function

Jianxuan He
Associate II
Posted on February 05, 2018 at 05:15

I am using STM32L031 by power of battery, so I wish to save power consumption.

Now the current consumption is about 200uA at stop mode.

May I change SWDIO and SWCLK to analogue GPIO after initialization?

May I further save power consumption by this way?

If OK, could you give some sample code to change 

SWDIO and SWCLK to analogue GPIO?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Szymon PANECKI
Senior III
Posted on February 05, 2018 at 08:48

Hello Jianxuan He,

Analog input is a recomended mode for all GPIOs, which are not used in the application. This solution reduces the current consumption of MCU.

I confirm, that you can change confuguration of the SWDIO and SWCLK pins to analog inputs. During the reset state of MCU these pins will be automatically reconfigured back to their original functions in order to act as a debug interface.

In addition I would recomend to switch off all clocks for GPIOs before entering STOP mode. This can also reduce the current consumption a little bit.

Regards

Szymon

View solution in original post

2 REPLIES 2
Szymon PANECKI
Senior III
Posted on February 05, 2018 at 08:48

Hello Jianxuan He,

Analog input is a recomended mode for all GPIOs, which are not used in the application. This solution reduces the current consumption of MCU.

I confirm, that you can change confuguration of the SWDIO and SWCLK pins to analog inputs. During the reset state of MCU these pins will be automatically reconfigured back to their original functions in order to act as a debug interface.

In addition I would recomend to switch off all clocks for GPIOs before entering STOP mode. This can also reduce the current consumption a little bit.

Regards

Szymon

Posted on February 05, 2018 at 08:56

Dear 

Szymon,

Thanks for your timely support!

I would try to further save power consumption.

Thanks!