Getting Started with EnergyTrace Technology
Learn about our new EnergyTrace technology that offers current monitoring on all MSP430 Microcontrollers (MCUs). On select devices, such as the MSP430FR59xx and MSP430FR69, this power profiling is taken even further with EnergyTrace technology
Resources
Hi, everyone. I'm Will Cooper, Product Marketing Engineer for the MSP430 team at Texas Instruments. Today I want to show you our exciting new EnergyTrace Technology for our MSP430 ultra low power microcontrollers. This energy profiling will be done in a unique way. Instead of amplifying the voltage drop over a shunt resistor at discrete times, a software control DC to DC converter is used to generate the target power supply.
The time density of the DC to DC converter charge pulses equals the energy consumption of the target microcontroller. A built-in on the fly calibration circuit defines the energy equivalent of a single DC to DC charge pulse. The benefit of continuously sampling is going to mean that you can see even the shortest amount of activity that consumes energy. When using the MSP-FET, our next generation programmer, with any MSP430 device, you will now be able to get real time current measurement profiles of your application.
If you're using select devices, such as those in the FR5 and FR6 Series, EnergyTrace++ Technology will be enabled. This will take power debugging to a whole new level. In addition to the current measurement, EnergyTrace++ Technology will offer information on both CPU and peripheral state. So let's see how it works.
Let's start by opening Code Composer Studio, Version 6 or later. If this is the first time you're trying to use EnergyTrace, what you need to do is go to Window, Preferences, Code Composer Studio, Advance Tools, EnergyTrace Technology. Here you'll see a brief description and you'll be able to enable it. Once it's enabled, it will remain enabled. You can then choose either EnergyTrace or EnergyTrace++.
EnergyTrace++ will only work on select devices such as the FR59 device that I will be showcasing today. But if you select this on a device that does not contain the functionality, it will default to EnergyTrace standalone. One more thing to remember is to make sure that you check the properties of your project. Go to Debug and MSP430 Properties, and make sure that the low power mode setting is checked for Enable Ultra Low Power Debug. This will enable you to get all of the full EnergyTrace functionality.
Now that everything is set up, I'll give you a few details about the EnergyTrace Technology control bar. So here you'll have a number of options, the ability to enable and disable EnergyTrace, a stopwatch feature which enables you to set the time limit for your energy profile. You can then Save Profiles, Load Profiles, go to an advanced menu, or switch back to the basic EnergyTrace mode.
So now I'm going to look at the code. I'm going to be running a few applications that vary by their low power optimization. More information on these particular examples can be found in our application note entitled, MSP430, Advanced Power Optimizations with document ID, SLAA603, on ti.com. What we have here is some very inefficient code that's taking a value for temperature and printing it. And it's using a bunch of printf statements, and as you'll see from EnergyTrace, it is not as efficient as it could be.
So I'll push the Debug button to get started. And now that the program is loaded, I'll run the code. And I'll set the stopwatch to five seconds. So I'll get a five second profile. And I'll push Run. As you can see, the EnergyTrace++ profile window, which gives you a high level overview of whether the application is in active mode or low power modes, as well as some of the peripherals that are being used, is filled in now. There are also a number of other windows that give you more depth.
So if you look at the power window, you can see the dynamic power consumption of the target over time. The energy window will show you the accumulated energy consumption of the target over time. Lastly, we have the States window. The States window is going to show you real time trace of the target microcontroller's internal states during the captured session. So what this means is you'll be able to see whether it's in active mode versus low power modes, and you'll also be able to see the current state of peripherals.
So one thing that's very clear from this window is that we're in active mode all the time, and that's definitely not good for power consumption. So what I'm going to do, I'm going to go back to our Profile window and I'm going to save this profile so we can look at it later. And I'll save that. And now we're going to go over and load the next level of code. So we have efficient code over here. So I'm going to stop the debug session and I'm going to make the efficient code my active code.
So one key difference in inefficient is that we're now using our own print function as opposed to using a regular printf. So it's much more efficient. I'm going to rebuild and re-debug. And when I run it, we'll get a new profile. So what you'll notice is now we're actually in a low power mode for most of the time instead of active mode. So if we come over here, we can see, we have a nicer power curve where we're not consuming as much power at a given point in time.
In addition, in our States curve, you can see that we're going into LPM1. Now that's actually weird because we're trying to go into LPM3 in our code. So the problem is that it turns out we're actually not setting a clock properly. So I'm going to save this profile as well. And then I'll go to the most efficient code where this has been fixed and the register value has been set such that the clock enables us to go into LPM3, which will consume much less power than LPM1.
So I'll rebuild and now I'll start the debug session again. The new profile will be generated when I run it. And one thing you'll notice is that now we're actually spending the majority of our time in LPM3, which is what we wanted. We're consuming a lot less energy here. You can see the power curve is spiking much higher and going into a much lower state. And the States actually show that you're going into LPM3 and that you're not using the peripherals as often.
So now I'm going to load the inefficient profile and we'll see how much better the code got. What you'll notice is that you get four additional columns, the two that actually say the regular run time and energy from the inefficient profile, and a delta, so you can actually see the difference. And what you'll see here is that there's a huge difference in the time that we've spent in LPM3 and in active mode, and you're also going to see big differences in peripheral usage.
If you want to see how the power and energy numbers stack up, you can come into these windows and you can see that there's a huge discrepancy between the inefficient code in yellow and our blue code, which is the efficient code. You can see a similar trend on the energy window. You might notice that in the power and energy tabs, there are no actual values on the y-axis. This is because with EnergyTrace++, debugging is going on that is affecting the absolute value, so that you can get things like state information.
So one way to rectify that so you can get absolute numbers is by switching over to the standard EnergyTrace mode. When you switch to this mode, you'll notice that you can then see milliwatts for power, and if you go to energy, you can see micro joules. So you can run just like you did before. And in this mode, you'll be able to actually capture exactly the current being used. You can still compare using a profile such as our inefficient one. And that way you can see with real numbers exactly how much energy you're saving.
This concludes my demonstration of EnergyTrace. I hope you all found it helpful and recognize that with EnergyTrace Technology paired with MSP430 ultra low power microcontrollers, power debugging is easier than ever before. So that means you can make sure your code is as energy efficient as possible, and you save battery power in your end application. If you would like to learn more or read the app note referenced earlier, head over to ti.com/energytrace and make sure your applications are optimized for low power.