You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚠ When reporting any issue, please try to provide all relevant information to help on its resolution.
Describe the bug
After calling begin() on HardwareSerial ports, running end() does not fully stop, and clean up the serial port.
Steps to reproduce the behavior:
Flash first code example, see a power useage of 25uA
Flash 2nd code sample, see power usepage of ~300uA
Expected behavior
The 1st example's current consumption should equal that of the 2nd
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
OS: Linux Mint
IDE version: PlatformIO
Upload method: [e.g. SWD] STLINK v2's SWD
Hardware (please complete the following information):
Board Name: STM32L073RZTx
Extra hardware used if any: PowerProfiler 2
Additional context
Add any other context about the problem here.
Code example 1, Power consumption ~25uA:
#include <Arduino.h>
#include "STM32LowPower.h"
// Create HardwareSerial objects
HardwareSerial Serial1(USART1);
HardwareSerial Serial2(USART2);
HardwareSerial Serial4(USART4);
void setup()
{
// // Initialize serial ports for a short period
// Serial2.begin(115200);
// Serial1.begin(9600);
// Serial4.begin(9600);
// // // End the serial ports
// Serial2.end();
// Serial1.end();
// Serial4.end();
LowPower.begin();
LowPower.deepSleep(20000);
}
void loop()
{
// Nothing to do here
}
Code Example 2, Calls both Begin() and End() however, this example runs at ~500uA:
#include <Arduino.h>
#include "STM32LowPower.h"
// Create HardwareSerial objects
HardwareSerial Serial1(USART1);
HardwareSerial Serial2(USART2);
HardwareSerial Serial4(USART4);
void setup()
{
// Initialize serial ports for a short period
Serial2.begin(115200);
Serial1.begin(9600);
Serial4.begin(9600);
// // End the serial ports
Serial2.end();
Serial1.end();
Serial4.end();
LowPower.begin();
LowPower.deepSleep(20000);
}
void loop()
{
// Nothing to do here
}
FINALLY,
running this example rund at around 1mA:
#include <Arduino.h>
#include "STM32LowPower.h"
// Create HardwareSerial objects
HardwareSerial Serial1(USART1);
HardwareSerial Serial2(USART2);
HardwareSerial Serial4(USART4);
void setup()
{
// Initialize serial ports for a short period
Serial2.begin(115200);
Serial1.begin(9600);
Serial4.begin(9600);
// // // End the serial ports
// Serial2.end();
// Serial1.end();
// Serial4.end();
LowPower.begin();
LowPower.deepSleep(20000);
}
void loop()
{
// Nothing to do here
}
The text was updated successfully, but these errors were encountered:
CropWatchDevelopment
changed the title
Calling Serial.end() not working on
Calling Serial.end() on STM32L073RZTx results in high power consumption
Mar 3, 2025
Hi @CropWatchDevelopment
This is normal as when you call end only the USART RCC are disabled.
Anyway the pins used by the Serial still configured mainly the GPIO clock, it could not be disabled because it do not know if another pins on the same GPIO port are used or not.
So it is up to the application to disabled those clocks.
Please, before reporting any issue
https://github.com/stm32duino/Arduino_Core_STM32/releases/latest
Any questions/feedback/suggestions should be discussed on the stm32duino forum:
⚠ When reporting any issue, please try to provide all relevant information to help on its resolution.
Describe the bug
After calling begin() on HardwareSerial ports, running end() does not fully stop, and clean up the serial port.
Steps to reproduce the behavior:
Flash first code example, see a power useage of 25uA
Flash 2nd code sample, see power usepage of ~300uA
Expected behavior
The 1st example's current consumption should equal that of the 2nd
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Hardware (please complete the following information):
Additional context
Add any other context about the problem here.
Code example 1, Power consumption ~25uA:
Code Example 2, Calls both Begin() and End() however, this example runs at ~500uA:
FINALLY,
running this example rund at around 1mA:
The text was updated successfully, but these errors were encountered: