8 years, 1 month ago.

Current consumption in sleep STOP mode

Hi,

I am implementing by myself the mDot in STOP sleep mode, because libmdot only has STANDBY mode implemented. Measured STANDBY current with libmdot is about 35uA. In STOP mode I am obtaining 150 uA current, but I expect about 45uA. Could you guide me with the pin settings and peripheral configuration for the lower current consumption? And could you tell me which are the pins used by mdot that have to be changed in sleep mode? Does the new LDO in last hardware version have to be controlled to decrease the power consumption?

Thank you and regards, Gilen

Question relating to:

Connecting to gateway, sending packets with a MultiTech mDot and entering deepsleep mode between transmissions. Lora, low power, mdot, multitech, Sleep

1 Answer

8 years, 1 month ago.

Hi Gilen,

I'm actually quite curious to hear how you got stop mode down that low. Would you be willing to share your application with us?

Cheers,

Mike

Hi Mike, I don´t do it with mbed and libmdot. I have implemented a porting of mDot to Contiki OS working with the transceiver in FSK modulation. I have configured all unused pins as analog inputs. And deinit all other pins to their less current state. But I think some other configuration is needed to achieve the optimum consumption. Cheers, Gilen

posted by Gilen Tell 17 Mar 2016

I think I recall seeing it that low. I did this with the mDot mbed library, but my own sleep routines (that I'm guessing are hardly any different then those in the mDot library). Like Gilen, I set all unused pins to the analog state (including JTAG and the oscillator pins). The LoRa radio has to have been configured so that it drops into its low power state. I also figured out that the SPI flash must have pull-downs on the write-protect and hold lines, as current consumption drops when I stop driving those lines. I think the only pins that remained in a non-analog state were the SPI bus to the SPI flash, and the pins to the LoRa radio.

You'll know if there's anything floating if you can put your fingers on the mDot and it alters the power consumption significantly.

posted by Michael Brudevold 17 Mar 2016

Hi Michael, I have configured all GPIOs like you. The only difference is the pull_down of HOLD and WP of flash, I had pull_up, and it could be a little less current with pull-down but is not appreciated much. Now mDot is consuming between 145-150uA. If STANDBY mode is 35uA, and the datasheet says that lowest STOP mode is between 10-14uA, I will expect between 43-47uA. Any other suggestion? Thanks, Gilen

posted by Gilen Tell 17 Mar 2016

The Flash memory has a pull up on the CS line and a pull down on the WP line. So those pins don't need pull ups or pull downs activated. One issue is that the NSS pin (processor pin PB_12) of the SX1272 does not have a pull up on it. If the NSS line drops low enough, the SPI interface of the SX1272 can become active and draw up to 100 uA of current.

posted by Timothy Barr 17 Mar 2016

Took me longer than I wanted to get it back to what I remembered, but my mDot is currently sipping 39uA @ 3.3V while toggling pin PA_0 once per second. I was getting about what you were (150 uA), until I enabled a pull-down on the HOLD pin of SPI flash. See if that helps...

posted by Michael Brudevold 17 Mar 2016

The one other thing to check would be the state of the MISO lines. These lines float when no slave has chip select asserted. The default for mbed does not have a pull selected for MISO, and the current consumption from the floating pin is noticeable in low power modes. If this doesn't help, paste all the pin settings you have and I'll see if there's anything obviously different.

posted by Michael Brudevold 18 Mar 2016

Hi Michael,

These are my pin settings in sleep STOP mode.

The JTAG pins are all ANALOGIC inputs.

GpioInit( &ioPin, PA_0, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_1, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_2, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_3, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_4, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_5, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_6, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_7, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_8, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_9, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); TX

GpioInit( &ioPin, PA_10, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); RX

GpioInit( &ioPin, PA_11, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PA_12, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PB_0, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PB_1, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PB_2, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 0 ); BOOT1

GpioInit( &ioPin, PC_1, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PC_4, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); to GND

GpioInit( &ioPin, PC_5, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); to GND

GpioInit( &ioPin, PC_6, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 ); Flash CS

GpioInit( &ioPin, PC_7, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 0 ); Flash HOLD

GpioInit( &ioPin, PC_8, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); Flash WP

GpioInit( &ioPin, PC_9, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PC_10, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); Flash SCK

GpioInit( &ioPin, PC_11, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 0 ); FLash MISO

GpioInit( &ioPin, PC_12, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); Flash MOSI

GpioInit( &ioPin, PC_13, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &ioPin, PD_2, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); to GND

Is there anything different compared to your configuration?

Thank you and regards,

Gilen

posted by Gilen Tell 18 Mar 2016

Hi again,

The SX1272 transceiver pins are here:

GpioInit( &SX1272.Spi.Nss, RADIO_NSS, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );

GpioInit( &SX1272.Spi.Mosi, RADIO_MOSI, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &SX1272.Spi.Miso, RADIO_MISO, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 0 );

GpioInit( &SX1272.Spi.Sclk, RADIO_SCLK, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &SX1272.DIO0, RADIO_DIO_0, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &SX1272.DIO1, RADIO_DIO_1, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &SX1272.DIO2, RADIO_DIO_2, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &SX1272.DIO3, RADIO_DIO_3, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &SX1272.DIO4, RADIO_DIO_4, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

GpioInit( &SX1272.DIO5, RADIO_DIO_5, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

Any suggestion?

Thanks, Gilen

posted by Gilen Tell 18 Mar 2016

Nothing is obviously jumping out at me. One change that might have lowered my power consumption (I can't remember if it did) was that I'm using the internal RC OSC, rather than the external crystal. Maybe try that?

posted by Michael Brudevold 21 Mar 2016

Hi Michael,

I think that the PLL, HSI and HSE RC oscillators are all disabled when the micro enters in STOP mode. The only one active is LSE or LSI. mDot has a 32.768 kHz low-speed external crystal and I have tried my software with LSE and with LSI, but the current is similar.

You mentioned that your consumption was 39uA @ 3.3V, but I suppose that this is in STANDBY mode. This is the same current that I get with the libmdot library in the sleep STANDBY mode.

I request libmdot Multitech developers that support me with this low power STOP mode, please. What minimum current consumption could I expect with mDot? Any other idea to reduce this current?

Thank you and regards,

Gilen

posted by Gilen Tell 22 Mar 2016

Here's the line of code I use to enter STOP:

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

So, pretty sure I'm not entering STANDBY (also given that my GPIO toggles, it has to be STOP as the variable to set/toggle the value lives on the stack and would get reset when exiting STANDBY mode).

I might have some time today to run an experiment for you, to see if I can recall the steps I took. I spent about a week getting the mDot into low enough power consumption that I can use it in an energy harvesting scenario. One of those steps was switching from the external crystal to the internal RC, mainly because I had to keep run-time current below a threshold. I don't have enough time to completely help you, so I can only throw out what I remember. But, do check the state of pins PH_0 and PH_1. It might have been that those float when the oscillators are disabled, but I don't remember.

posted by Michael Brudevold 22 Mar 2016

Hi Michael,

Yes, the issue is somewhere there in PH_0 and PH_1. I have noticed it when I put my finger near the 26MHz crystal pads, and the amperimeter shows 80uA. The main loop of my application is running with external crystal and LSE.

I am trying to configure PH_0 and PH_1 as analogic inputs when the program goes to sleep. This is my code before going to STOP mode.

/* Enable HSI */

RCC_HSICmd( ENABLE );

/* Wait till HSI is ready */

while (RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET) {}

/* now switch to this source */

RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);

RCC_HSEConfig( RCC_HSE_OFF );

GpioInit( &ioPin, OSC_HSE_IN, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 1 );

GpioInit( &ioPin, OSC_HSE_OUT, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 1 );

But when the GpioInit function is executed, my program jumps to HardFault_Handler. Does the STM32F411RE have any limitation with PH_0 and PH_1 as GPIO? Or am I doing anything wrong in those steps?

Thank you for your time and best regards,

Gilen

posted by Gilen Tell 22 Mar 2016

Did you enable the IO port H clock in RCC_AHB1ENR? I do basically the same as you, though I never enable HSE:

pin_function(PH_0, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_PULLDOWN, 0)); pin_function(PH_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_PULLDOWN, 0));

The reference manual doesn't indicate any limitations, just that HSE takes priority over GPIO if HSE is enabled.

posted by Michael Brudevold 22 Mar 2016

Hi,

I had a problem with the GPIO driver and PortH pins. I have resolved it and the current is now 80uA. Could you confirm me that your mDot consumption in STOP mode is 40uA? If this is true, this should be my goal and there is still room for improvement. Thank you for your invaluable help. And if you remember any other adjustments to reduce this current, please let me know.

Best regards, Gilen

posted by Gilen Tell 22 Mar 2016

Yes, 40uA is what I saw.

Did you configure flash and the regulators? Such as:

HAL_PWREx_EnableMainRegulatorLowVoltage(); HAL_PWREx_EnableFlashPowerDown(); HAL_PWREx_EnableLowRegulatorLowVoltage();

See section 5.3.4 Stop mode in the Power controller (PWR).

posted by Michael Brudevold 22 Mar 2016

I Michael,

In table 17 Stop operating modes, I am activating the STOP LPLV, that I think is the less current consumer. (LPLVDS and LPDS bits). Electrical characteristis in datasheet say 10uA.

Your configuration seems to be STOP MRLV. (MRLVDS and LPLVDS bits) Electrical characteristis in datasheet say 14uA.

Anyway, I will try these other configurations. I suggest you try the mode STOP LPLV , to verify if you save 4uA.

posted by Gilen Tell 23 Mar 2016

Hi again,

I am meassuring 54uA @ 3.3V just now. Previously I was measuring the current when powering with a Varta battery of 3V. With a laboratory power supply, I noticed that with voltage below 3V the current is 80uA and with upper voltages the current is 54uA. I don't know which is the explanation.

However, they spare me 14 uA to reach the goal of 40uA.

Regards,

Gilen

posted by Gilen Tell 23 Mar 2016

Did you put the SPI flash in deep power down?

posted by Michael Brudevold 23 Mar 2016

How can I do that?

I only have configured the GPIOs connected to SPI Flash.

GpioInit( &ioPin, PC_6, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 ); Flash CS

GpioInit( &ioPin, PC_7, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 0 ); Flash HOLD

GpioInit( &ioPin, PC_8, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); Flash WP

GpioInit( &ioPin, PC_10, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); Flash SCK

GpioInit( &ioPin, PC_11, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 0 ); FLash MISO

GpioInit( &ioPin, PC_12, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); Flash MOSI

Does I have to send any command by SPI? Do you know the Flash SPI reference to study its datasheet?

posted by Gilen Tell 23 Mar 2016

I have downloaded the Micron's M25P20 2Mbit Flash datasheet. I see that the command 0xB9 is needed to put it in deep power down (1-5 uA), and not in the default standby mode (10-50 uA).

Thanks for the hint, I'm sure this is the final solution. I will try this next week.

Have a nice weekend and happy Easter!

Gilen

posted by Gilen Tell 23 Mar 2016

Hope that does it! BTW, I checked and I do believe I'm entering LPLV. The call to HAL_PWR_EnterSTOPMode with parameter PWR_LOWPOWERREGULATOR_ON sets the LPDS bit.

posted by Michael Brudevold 23 Mar 2016