GrumpyOldPizza / ArduinoCore-stm32l0

Arduino Core for STM32L0
125 stars 67 forks source link

B-L072Z-LRWAN1 Power Consumption #174

Closed BobbyCounts closed 3 years ago

BobbyCounts commented 3 years ago

I've have been trying to lower the power consumption of the B-L072Z-LRWAN1 dev board I plan on using for a low power project. I have been having problems getting the consumption down to the low uA range that I've heard some people achieve. I am currently only able to get to 350uA during stop using the STM32L0.deepsleep() function.

I've made the following modifications to the board:

I'm not sure what could by causing the 350uA current. I'm hoping the more experienced may have a place to start looking?

I ran out of headers, so I haven't measured the current of the individual IDD current lines. I have more on order and can provide those measurements if they will help troubleshooting.

I'm using the current master branch of the library

A snippet of my main loop:

void loop( void )
{
    char dataPayload[24];
    if (LoRaWAN.joined() && !LoRaWAN.busy())
    {
        Serial.print("TRANSMIT( ");
        Serial.print("TimeOnAir: ");
        Serial.print(LoRaWAN.getTimeOnAir());
        Serial.print(", NextTxTime: ");
        Serial.print(LoRaWAN.getNextTxTime());
        Serial.print(", MaxPayloadSize: ");
        Serial.print(LoRaWAN.getMaxPayloadSize());
        Serial.print(", DR: ");
        Serial.print(LoRaWAN.getDataRate());
        Serial.print(", TxPower: ");
        Serial.print(LoRaWAN.getTxPower(), 1);
        Serial.print("dbm, UpLinkCounter: ");
        Serial.print(LoRaWAN.getUpLinkCounter());
        Serial.print(", DownLinkCounter: ");
        Serial.print(LoRaWAN.getDownLinkCounter());
        Serial.println(" )");

        // Send Packet
        LoRaWAN.sendPacket((uint8_t *)payload, sizeof(payload), false);

    }
    Serial.end();       
    STM32L0.deepsleep(10000); //10 Seconds
    Serial.begin(9600);
}
GrumpyOldPizza commented 3 years ago

Sorry, no clue. The ST DISCOVERY/NUCLEO platforms are not really that great for low power prototyping (i.e. somewhat complicated).

You do not need to do Serial.end() / Serial.begin(), unless Serial points to USB.

I suppose the ST-Link part could cause some of the consumption. LEDs are always in the 200uA to 300uA range. I did check that the TCXO via PA12 is hooked up correctly in the variant.cpp file.

What else is connected to the system ?

On Wed, Feb 24, 2021 at 12:13 PM bob1033 notifications@github.com wrote:

I've have been trying to lower the power consumption of the B-L072Z-LRWAN1 dev board I plan on using for a low power project. I have been having problems getting the consumption down to the low uA range that I've heard some people achieve. I am currently only able to get to 350uA during stop using the STM32L0.deepsleep() function.

I've made the following modifications to the board:

  • Opened SB6 to disconnect regulators. I feed 3.3V from my power supply to the 3.3V pin and measure current with a shunt.
  • Opened SB37 to release the reset line from the ST-Link
  • JP9 is in the 1-2 position, so PA12 can control the TCXO

I'm not sure what could by causing the 350uA current. I'm hoping the more experienced may have a place to start looking?

I ran out of headers, so I haven't measured the current of the individual IDD current lines. I have more on order and can provide those measurements if they will help troubleshooting.

I'm using the current master branch of the library

A snippet of my main loop:

void loop( void ) { char dataPayload[24]; if (LoRaWAN.joined() && !LoRaWAN.busy()) { Serial.print("TRANSMIT( "); Serial.print("TimeOnAir: "); Serial.print(LoRaWAN.getTimeOnAir()); Serial.print(", NextTxTime: "); Serial.print(LoRaWAN.getNextTxTime()); Serial.print(", MaxPayloadSize: "); Serial.print(LoRaWAN.getMaxPayloadSize()); Serial.print(", DR: "); Serial.print(LoRaWAN.getDataRate()); Serial.print(", TxPower: "); Serial.print(LoRaWAN.getTxPower(), 1); Serial.print("dbm, UpLinkCounter: "); Serial.print(LoRaWAN.getUpLinkCounter()); Serial.print(", DownLinkCounter: "); Serial.print(LoRaWAN.getDownLinkCounter()); Serial.println(" )");

    // Send Packet
    LoRaWAN.sendPacket((uint8_t *)payload, sizeof(payload), false);

}
Serial.end();
STM32L0.deepsleep(10000); //10 Seconds
Serial.begin(9600);

}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXBA7CHJP4HZMY3EXASENDTAVFUBANCNFSM4YFC3JGQ .

gitMichael commented 3 years ago

It's absolute no problem to get Idd down to spec values with the B-L072Z-LRWAN1. That's it make for.

~340uA sounds like the DGB-Interface. Try open CN8 jumper and restart the mcu. Or a running UART but it should be a LPUART and also not run in sleepsleep / stop mode with your setup.

BobbyCounts commented 3 years ago

Okay, some more testing:

This leads me to believe something with the onboard ST-link is causing the current draw. However, I don't know where the draw is occurring as the ST-link should be completely isolated from the module now.

@gitMichael Have you been able to get the spec values on the B-L072Z-LRWAN1 before?

gitMichael commented 3 years ago

Yes, you can reach with ArduinoCore-stm32l0: 1.05uA for Imcu JP3 (SB14 open), 0.15uA for Irf JP1 (SB17 open) and ~0.1uA Iusb JP2 (SB19 open).

With only one deepsleep() function call in standard config with everything connected and initialized but SB37 open (nRST costs 4uA) it's possible w/o problems.

Try measuring currents at JP1..3 first. With a voltage at CN13 (+3.3V pin) you backpower U7 too (SB6 closed by default).

BobbyCounts commented 3 years ago

Thanks Michael, I'll measure JP1-3 and report back.

BobbyCounts commented 3 years ago

I have figured out the issue causing the excessive current draw. In the schematic below the ST-Link is connected to the microcontroller's 3.3V rail on pin PA0 via a 4.7K resistor. This resistance isn't quite high enough and causes the rail to back-power the ST-Link through what I assume are some protection diodes. This causes the 400uA of excess current.

stlink

I fixed this issue by removing resistor R26 from the board. Now I'm reading a sleep current of around 2uA (including a low Q power supply I'm using).