This master's thesis focuses on reducing the electrical energy consumption of a microcontroller, that is running an application with FreeRTOS real-time operating system. The optimization is intended for use in electric power consumption meters. It is based on utilizing the microcontroller's unused peripheral timers. Specifically, we replaced the SysTick timer, which is used by the FreeRTOS core for tracking time, with the CC blocks of peripheral timers. This modification allows the microcontroller to enter sleep mode sooner and more frequently. To achieve this, we introduced new functions into the FreeRTOS kernel, modifying its original operation. The thesis describes the previous method of recording the state of time-dependent tasks using lists and TCB structures. It also details the new functions, that were added for optimization and the rationale behind their effectiveness. For testing and evaluating these improvements, a printed circuit board was developed to simulate the behavior of a simplified power consumption meter. A program was also created, which contains seven tasks that work in conjunction with the PCB. The thesis includes descriptions of the individual parts of the PCB and the components used on it. It also provides more details about the tasks and their interconnections. Using this setup, we compared existing optimizations offered by FreeRTOS with our own. Our findings reveal that our method of using peripheral timers in combination with sleep mode is less energy-intensive, reducing energy consumption by up to 27.7% compared to a system without using sleep mode and by 12.2% compared to the system that uses SysTick timer and sleep mode.
|