Low Power Mode (Suspend to RAM) in uCLinux for Freescale Kinetis K70 MCU
All ARM based micro-controllers and processors implement multiple power mode in order to save optimize power usage depending on the tasks. However, I’ve been told by some hobbyists/developers/makers that low power modes are not always implemented in Linux, especially for low cost systems either because of hardware limitations or the software is not implemented. EmCraft Systems has just released their latest embedded (uC-) Linux distributions for the MCU boards, and one of the features now available is “suspend to RAM” for their K70 SoM development kit, based on Freescale Kinetis K70 Cortex M4 MCU, which consume just around 600 to 700 uA @ 3.3V (2 to 2.3 mW) in this low power mode.
They have connected a multimeter to measure the current drawn at different power modes. If you want to know all the details, you should probably read the company’s article on “Linux Low-Power Mode on Kinetis“, but I’ll summarize the key points in this posts.
They checked the current in three different power modes:
- Idle mode – 104 mA
- Under load (loop) – 137.30 mA
- Suspend to RAM mode – 0.6 to 0.7 mA, with Ethernet module 2mA
So you’ll consume about 150 to 175 times less power in suspend to RAM mode compared to idle mode, so depending on the application, that could make a difference between the battery lasting just one day and a few months.
In order to enter this low power mode, you can simply type the following in the serial console:
echo mem > /sys/power/state
The system will enter low power mode, and pressing a key in the UART console will wake up the system immediately and get back to idle mode.
This is nice for testing, but real life applications may be limited. A more practical approach is probably to use the RTC in the system to wake up the system as regular intervals. For example to automatically wake up the system after 5 seconds:
echo +5 > /sys/class/rtc/rtc0/wakealarm; echo mem > /sys/power/state
They’ve also provide a typical example script where you log data, in this case the date, at regular intervals. There’s still more work to do however, as if you use Ethernet, you’ll lose connectivity after the first suspend, and pressing the reset is required to allow the Ethernet interface to recover.
The demo config files for the kernel and busybox, and the rootfs file are available on here, but you’ll need to be a customer to download the source code to actually build the demo. EmCraft Systems also relatively regularly commits code to their github account for Linux and U-boot, but the latest changes for Freescale K70/K61 have not been added just yet.