cancel
Showing results for 
Search instead for 
Did you mean: 

Power meas. - How to put PA13 and PA14 to analog no pull up and no pull down?

DS.4
Senior II

Hi

I am using X-NUCLEO-LPM01A to measure some currents on P-NUCLEO-WB55 according to video:
https://www.youtube.com/watch?v=7IVs-nuoXj8.

To keep ST Link enbaled the commentator asks to put some pins to analog state , no internal pull-up , and pull-down state

 

See here:

DS4_0-1706018159101.png

How do I do that?

 

6 REPLIES 6
Andrew Neil
Evangelist III

You can link to a specific time in a YouTube video:

AndrewNeil_0-1706020093885.png

eg, https://youtu.be/7IVs-nuoXj8?t=736

 


@DS.4 wrote:

To keep ST Link enbaled the commentator asks to put some pins to analog state


I think you may have misunderstood what he meant: that will still break the debug connection - it just saves you having to physically fit & remove the jumpers.

Also, if you're trying to get your application down to really the lowest possible current level, this will still leave some leakage - so you'll still need to physically disconnect.

Anyhow ...

 


@DS.4 wrote:

How do I do that?


Something like this:

 

  GPIO_InitTypeDef GPIO_InitStruct;

  GPIO_InitStruct.Mode  = GPIO_MODE_ANALOG;
  GPIO_InitStruct.Pull  = GPIO_NOPULL;
  GPIO_InitStruct.Pin   = GPIO_PIN_All;

  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

 

 

DS.4
Senior II

"that will still break the debug connection" - why?

Prior to adding PIN13 and PIN5 to be analog, I Ran a quick test , programmed the WB55 in debug mode (CubeIDE) , and ran.

Have some weird base current of 1 mA on advertising during sleep.  (BleHeartRate example)
But then,  I do get to hold a breakpoint on connection event  , debug doesn't break. But I see the current jump high to 3mA while I am holding the break point. here:

2.png

Exiting debug:

Pressing the" Reset button" on WB55 does not exit debug.

Only if I press "RESET TARGET" on STM32CubeMonitor-Power than I lose it. And only then I see datasheet sleep currents. (3uA). See here:

1.png

 

So what's going on? and what is then the correct way to keep debug with sleep if I need it?

 

 

 

 


@DS.4 wrote:

"that will still break the debug connection" - why?


Because you are disconnecting the SWD connection - which goes through those pins.

 


@DS.4 wrote:

So what's going on? and what is then the correct way to keep debug with sleep if I need it?


You will never get true low power readings with a debugger connected - the debugger keeps the CPU awake.

Also, as mentioned earlier, the physical connection will give you some leakage/stray currents.

As well as the SWD connections, also check:

  • Reset from the ST-Link
  • Target voltage sense
  • UART connection
  • Trace connection
  • Connections to other "features" on the dev board.

It is a non-trivial exercise to find & disconnect all these things, and the ST documentation is often incomplete; eg:

https://community.st.com/t5/stm32-mcus-wireless/current-consumption-in-stop-mode-using-b-l072z-lrwan1/m-p/448139/highlight/true#M14437

(unfortunately the link in that post seems to be broken)

EDIT: I found what it should link to:

https://community.st.com/t5/stm32-mcus-wireless/excess-current-consumption-running-b-l072z-lrwan1-from-battery/m-p/322961

 


@DS.4 wrote:

what is then the correct way to keep debug with sleep if I need it?


You can't have both sleep and debug - choose one.

 

AndrewNeil_0-1706090742437.png

 

Thanks @Andrew Neil 

 if there is a base current that draws by keeping debug that's fine by me , I will deduct it in the end. My issue is that @ST didn't make a full video showing what that current levels should be.

Even having this information for their specific board and code example will be fine.

So as you said, I am not sure the 1mA is good or I am having something else drawing current ...

Would like @ST to give us their expected numbers for the current draw in that case, and maybe describe the correct way to debug sleep and keep debug on their example.


@DS.4 wrote:

My issue is that @ST didn't make a full video showing what that current levels should be.


Not everything is best presented as a video!

Current consumption figures are given in the datasheet:

AndrewNeil_0-1706177562521.png

As it says, the consumption depends on many things - and not just the physical characteristics of the chip but also the nature of the particular application (hardware & software).

So it's really not possible to give a simple statement, "current consumption is X".

But it would be useful if ST would give some figures for a specific reference application on a specific board under specific conditions - with full details of the conditions of measurement.