Texas Instruments has put together a tool aimed at users of its MSP430 microcontroller family that will help guide them through techniques that cut the power consumption of their applications.
When TI’s MCU division general manager Emmanuel Sambuis, hinted at Embedded World in Nürnberg, Germany that the company was working on a power-analysis tool for the Wolverine being launched that day, I had expected it to be use a combination of trace capture and activity analysis – that is, look at which code was showing the highest activity and power consumption.
Instead, the company has opted for its ULP Advisor to go down the road of static analysis. This may seem counter-intuitive: how can you tell from simply looking at the source code how the application will perform power-wise? However, the wiki that supports the tool as well as other aspects of MSP430 design helps explain.
The tool looks for telltale signs that an application is making the most of the hardware. The first rule on the list in the wiki is to check whether the target is configured to ever go to sleep. It does this by looking for the function calls or macros typically called by the main C program to enter one of the low-power sleep modes.
Although some of the rules are pretty obvious – such as using direct memory access (DMA) for large transfers and avoiding processor-intensive code where possible – some of the rules bear closer inspection.
One rule is to terminate unused general-purpose I/O. These are easy to forget but can lead to floating voltages and shoot-through current on the unterminated pins. However, it is relatively straightforward to make register accesses that clamp the unused pins.
Another one that older programmers may remember for code density rather than power efficiency reasons is to count down rather than up in loops: it saves one instruction per cycle.