Enable the most efficient debugging using the ARM Serial Wire Output

Rasmus’ tips for ARM Cortex-M energy efficiency #1. 

tip_1

rasmus

Rasmus is a Support & Training manager at Energy Micro, supporting customers with technical articles, seminars, and video materials. He also operates “The Lizard Lounge” forum open to everyone to share engineering ideas and application design tips.

In a series of posts on the Energy Micro blog, I´ll take a closer look at some of the features that are available for ARM Cortex-M microcontroller users. I will also show you some examples how I normally use them, and how they can be helpful when trying to reduce the energy consumption in embedded applications. First in the series is the SWO interface.

ARM’s Serial Wire Output (SWO) interface is a useful tool, because it helps me to find bugs in a fast, simple, and energy efficient way. With just 1-pin, the Serial Wire Viewer output gives me an instrumentation trace interface. You just need to write printf-style debug messages in your application code to make it work. You can also see the messages directly in your IDE, or through dedicated SWO viewers like Segger’s J-Link SWO Viewer. I use the energyAware Commander to read out my starter kit information.

1.

Picture of Giant Gecko or Wonder Gecko kit connected with information 

As the SWO is already built into the Cortex-M core hardware itself, you don’t have to waste any of your regular UARTs to get this working. This technique is especially helpful when you develop an application which requires the lowest sleep modes of the microcontroller and no regular debug connection is allowed. The instrumentation trace can also be used for sampling the program counter and enables IDEs to create statistics on how much time is spent in each of your program functions.

To get the most out of SWO feature, I use the built-in current measurement hardware that you find in all EFM32 starter and development kits. I personally use the energyAware Profiler software tool for most of my daily embedded development. Then I get live current measurements and power profiles directly from the kit, and it’s faster than hooking up an oscilloscope or even a multimeter. It has built-in features that replace these tools, and it only occupies a USB port. As a bonus feature when you test it, you can exactly pinpoint, and in real-time, which program functions are the highest energy drains in your application.

Watch an example on how energyAware Profiler is used to map energy consumption and source code in real-time:

Download Energy Micro’s free software tool, Simplicity Studio, and use the energyAware Profiler now: Simplicity Studio

Download a relevant application note and learn more about EFM32 debug and SWO: EFM32 Debug and Trace

Any technical questions? Find your answer on our forum!