In the realm of embedded systems, particularly within Hexabitz modules, power management is paramount. One effective strategy for minimizing power consumption is the implementation of “stop mode,” a power-saving state that is especially advantageous when operating on limited power sources such as batteries. This article explores the mechanics of stop mode, its benefits for Hexabitz modules, and how to implement it using the available API.
Overview of Stop Mode
Stop mode is engineered to achieve minimal power consumption while retaining the contents of SRAM (Static Random-Access Memory) and CPU registers. In this state:
• All clocks in the VCORE domain—including PLL (Phase-Locked Loop), MSI (Multispeed Internal) RC, HSI16 (High-Speed Internal 16 MHz) RC, and HSE (High-Speed External) crystal oscillators—are disabled.
• External oscillators, such as Low-Speed External (LSE) or Low-Speed Internal (LSI), may remain operational to support essential functions like the real-time clock (RTC).
• The system can swiftly resume normal operations when necessary, striking a balance between energy efficiency and performance.
This feature is crucial for battery-powered applications, as it significantly extends product lifespan.
Current Consumption
The following are the current consumption values for different power modes in Hexabitz modules:
- Run mode: 28 mA
- Stop mode: 1.5 mA
- Standby mode: 0.2 mA
Advantages of Stop Mode in Hexabitz Modules
Hexabitz modules are frequently deployed in remote or battery-operated settings where energy optimization is vital. The integration of stop mode provides several key advantages:
➔ Extended Battery Life: By reducing power consumption during inactive periods, stop mode conserves energy and prolongs battery life.
➔ Data Retention: The mode preserves SRAM contents and critical system registers, allowing seamless resumption of operations without the need for reinitialization.
➔ Versatile Power Management: Hexabitz modules can dynamically alternate between run and stop modes, enabling efficient management of varying operational states based on application needs.
Implementing Stop Mode on Hexabitz Modules
To transition Hexabitz modules into stop mode, developers can utilize the Bit Operating System (BOS) API or messaging code. The API facilitates control over various module functions, including power management. To activate stop mode and configure wake-up via UART1, UART2, or UART3, the following function can be employed:
BOS_Status EnableStopModebyUARTx(uint8_t port);
Alternatively, the messaging code approach can be executed as follows:
messageParams[0]=P1;
/* enable stop mode regarding only UART1 , UART2 , and UART3 */
SendMessageToModule(2, ENABLE_STOP_MODE_UARTX,1);
Parameters:
port: Indicates which port will trigger a wake-up from stop mode.
This functionality allows the Hexabitz module to enter stop mode while determining the specific UART port for wake-up. During stop mode, power consumption decreases as high-speed oscillators and other components are deactivated, yet low-speed oscillators and certain peripherals like UART or I2C remain active. This setup enables the system to quickly react to external events or signals, making it particularly useful for idle modules awaiting input.
Example: Entering Stop Mode on Hexabitz Modules
Consider an example involving three Hexabitz modules: H0BR4, H21R02, and H01R0. The objective is to place the H0BR4 module into stop mode to conserve energy while the H21R02 module sends the command to activate stop mode and the H01R0 module triggers a wake-up from this state.
Figure (1): Assembling modules
To facilitate this process, one of the UART ports (UART1, UART2, or UART3) must be connected to the selected port. Reviewing the H0BR4.h file reveals that ports P2, P4, or P6 can be utilized; for this example, we will select P2.
Steps:
- Access the topology file for the matrix.
- Write instructions to finalize the project and enter stop mode.
1. Enter stop mode:
On the H21R02 module, we will use the SendMessageToModule() API to send the ENABLE_STOP_MODE_UARTX command to the H0BR4 module. This is triggered by pressing a button. The implementation is as follows:
void UserTask(void *argument){
AddPortButton(MOMENTARY_NO, P3);
SetButtonEvents(P3, 1, 0, 0, 0, 0, 0, 0, 0,1);
while(1){
// Your recurring code here
}
}
void buttonClickedCallback(uint8_t port){
IND_blink(500);
messageParams[0] = P2;
SendMessageToModule(2, ENABLE_STOP_MODE_UARTX, 1);
}
2. Wake up from stop mode:
On the H01R0 module, we use the SendMessageToModule() API to send the CODE_PING command to wake up the H0BR4 module via P2 when the button is pressed. The implementation looks like this:
/* User Task */
void UserTask(void *argument) {
// put your code here, to run repeatedly.
AddPortButton(MOMENTARY_NO, P3);
SetButtonEvents(P3, 1, 0, 0, 0, 0, 0, 0, 0,1);
while (1) {
// Your recurring code here
}
}
void buttonClickedCallback(uint8_t port){
IND_blink(500);
SendMessageToModule(2, CODE_PING, 0);
}
By implementing these strategies effectively, developers can maximize energy efficiency in Hexabitz modules, ensuring longer operational lifespans and improved performance in battery-dependent applications.