Sometimes real gems are hiding in plain sight. We are bombarded by data, and who knows what brilliant discoveries we miss in the cacophony of noise. A friend might point out something. “Hey, have you seen…” and call our attention to an item. We take a look and, lo and behold, that magic something emerges – a piece of music, an idea, a book, a tool that fills a real need. You wonder how you lived without it, and it has been in front of you all along.
FreeMASTER may be such a discovery for you. It has been available in Freescale’s roster of development tools for years. Really. With almost no fanfare or publicity, this little gem has been startling discoverers and generating smiles on the face of its users. So, what is it?
FreeMASTER is a real-time debug monitor. Ho hum? Let’s define the problems it solves. You’re writing software for a real-time system, like: a motor running an appliance; the engine control in a car; the sensors in an airbag; the control surface of an airplane; or anything that has a feedback loop. Now, try to debug that dynamic system real-time. Yes, sometimes you need to stop the system to study its state. More often you need to see it operate dynamically, to control it dynamically, to see why it goes wrong as it works! You cannot do that with a normal debugger. You need FreeMASTER.
Data visualization
With FreeMASTER you establish a communication channel to the target. You monitor variables of interest in real-time, at sampling rates you determine. You can modify those variables real-time, that is, you can push data down the pipe to the target to modify the behavior of the system dynamically.
The native data visualization display within FreeMASTER is the oscilloscope. You can display multiple variables, and have all the control options you’d expect of a scope.
Figure one shows FreeMASTER tracking two simple variables. One is a short value rising to maximum and falling to zero. The other generates a sine waveform by reading data from a table. I changed the step increment about halfway through to show you that you can push values to the target.
Figure 1: FreeMASTER tracks and displays variable values real-time.
But it gets much better.
The display area is arbitrarily extensible via HTML. If you master FreeMASTER, you can add third-party instrumentation “widgets” based on ActiveX and embed them in the display area. You can wire them up to variables analogous to the way the oscilloscope works, reading and/or changing values. In this way you can create as elegant or complex a dashboard as you like to represent the system you are testing or demonstrating. This open-ended design makes FreeMASTER an extraordinarily flexible and powerful tool. Figure 2 is an example screenshot of an animated display representing engine knock behavior and feedback control as handled by our Qorivva MCUs based on Power Architecture technology.
Figure 2: The data visualization area of the FreeMASTER tool is arbitrarily extensible.
As they say with Ginsu knives, “but wait, there’s more…”. You can embed slide shows, presentations, data sheets, or entire packages of information around a product or a problem. We do it. A really solid example is the FreeMASTER project for the Tower System for Automotive Sensors that I wrote about here. That has data sheets, block diagrams, and prebuilt scopes for all the sensors, all inside a single FreeMASTER project.
Data recording
FreeMASTER also implements a data trace capability called the Recorder. The Recorder uses an on-target buffer to store data readings and then downloads the buffer to the data display. It captures data at a higher and more reliable sampling rate than the oscilloscope (near ten-microsecond resolution). Clearly this can have some impact on the real-time performance of your application, but the data capture can be invaluable for analysis. You identify the variables (up to eight) you want to capture, and specify the size of the on-target buffer.
You also specify a trigger event to start the sample.
In the “real time” analysis that you can do with the scope, you see things as they happen. That is actually a relatively coarse view with a fair degree of interpolation in the data visualization. You have no ability to zoom into the data to analyze it at a fine level of granularity. The sampling rate is not precisely consistent. A lot can happen during the intervals between the samples. For example, if we were to pull that same sine wave data at a high increment “real-time,” it would get pretty ugly. Figure 3 hardly looks like a sine wave at all and, depending on how fast your data is changing, this display may not be adequate for you.
Figure 3: Real-time in the oscilloscope has its limitations.
The resolution of the recorder, at microsecond level, is much finer. In Figure 4 you can see a data trace using the same high increment. That sine wave looks pretty smooth at millisecond resolution.
Figure 4: The data recorder captures data at fine time resolution
Even still, everything is relative. Figure 5 shows you that you can zoom in on data. When looking at the data at microsecond resolution, you can see the stepwise increases induced by the fact that we are pulling data from a table of values.
Figure 5: A conceptual representation of the FreeMASTER zoom capability.
All of this should demonstrate that you can use FreeMASTER to study your data as you need, at the level of detail demanded by your application. You can also capture the data to a text file for later analysis in other tools if you wish. Setting up the data trace is typically a matter of configuring the recorder in FreeMASTER to specify what variables you want to trace. If you want to change the default buffer size, then you’ll modify a header file. It is pretty simple stuff.
Platform support and connections
Real-time data monitoring does not come without some performance price. It takes cycles to read or store data and push it up the pipe. But, FreeMASTER has multiple ways of communicating, some of which are very-low intrusion, such as OSBDM. Others require an on-target driver. The Table below summarizes platform support and connection protocols. The BDM connections are very near to zero-intrusion on the running software. The data trace we were just talking about requires a target driver.
Table 1: Where and how you can use FreeMASTER.
Hardware-in-the-loop-simulation
Perhaps the most exciting capability of the tool is that the data output can be retargeted. Like the design of the data visualization engine, the data stream itself is not restricted to FreeMASTER. The data is accessible through an ActiveX interface to any application that can consume ActiveX services, such as MATLAB, Excel, Internet Explorer, PERL, VBScript, Jscript, and so on. What you can do is limited only by your imagination.
Here are two high level use cases involving FreeMASTER feeding data into MATLAB or Simulink.
You might use real-time, real world data rather than theoretical data to feed input into a complex simulation, and see how the model would respond.
Alternatively, take a set of identical inputs and run them simultaneously in both the processor and the model, using FreeMASTER to stream the results out of the processor. Compare the results from the two systems to see how the model does against reality, thus establishing whether the model is valid, and if so, under what conditions.
FreeMASTER enables both of these scenarios for testing models of highly complex dynamic and non-linear systems. Talk about way cool.
If you’ve read this far, I think I’ve got you hooked. However, here’s one more facet on the gem.
Integrating FreeMASTER with the CodeWarrior tools is simple.
Since there is typically an on-target driver involved, you often will add source code and integrate it into your project. This gives you the flexibility, as noted above, to do things like change buffer sizes really easily. When you configure FreeMASTER itself for your visualization displays, you’ll save the information in a FreeMASTER project file. I added that FreeMASTER project file into the related CodeWarrior project by drag and drop, done. Double click inside the CodeWarrior tools, FreeMASTER launches. Simple and sweet, no need to go hunting for anything.
True to our overall enablement philosophy, of course you aren’t required to use a particular development environment. FreeMASTER is a separate application. You can download it, and the required communication driver software, here. You can build them in other development environments, like the IAR tools for example.
Also, true to its name, FreeMASTER is complimentary. Seriously. This much functionality at this price?
I told you it was a gem.