I think the most important tool for a firmware engineer is a Logic Analyzer. I always have one on my desk. Working in different locations, sometimes I forget to carry it with me. And for sure I would need it. To buy another one to compensate my laziness? Or maybe there is another solution? And here I stumbled over an article about the Logic Sniffer project recently: it is about an open source logic analyzer hardware and firmware project. What a cool idea! Why not using my FRDM-KL25Z Freedom board as a Logic Analyzer? Heck, that would be awesome🙂
After some nights of plumbing and research, I finally have it working. And here is all the information to do the same with your Freedom Board…
💡 While this post is using the Freedom board, it is not limited to that board. Actually the software works with any other microcontroller🙂
The architecture is rather simple: on the Freedom board I have an application running which uses input pins to record the logic signals and stores it into a RAM buffer. The application communicates with the host over COM (Virtual COM, OpenSDA USB CDC in my case) with the SUMP protocol. On the host there is a client implemented in Java running which does all the presentation. Simple as that🙂.
A CodeWarrior for MCU10.3 project is available on GitHub. This project implements a Logic Analyzer probe. It is using the OpenSDA USB CDC port to communicate with the client. I have configured the SCI to communicate with 115200 baud.
Once running the probe, the Freedom blinks the red RGB LED:
Connecting to Signals
The Freedom board headers can be used to connect to the external signals. Be aware that GND needs to be connected, and that the FRDM board is 3.3V. So do *not*❗ connect to higher voltages as this might destroy the board!
Installing OLS Client
I use the Logic Sniffer OLS client, written in Java (cross-platform). I downloaded it from http://www.lxtreme.nl/ols/. Installation is easy: unzip it to a folder on the host machine:
The client is using configuration files for all the different probes supported. I have prepared a configuration file for the FRDM-KL25Z board. Download the file ols.profile-FRDM-KL25ZLogicLogger.cfg from GitHub and place it inside the plugins folder of the client:
Run the client with the ‘run.bat’ in the client software root folder. This opens a DOS shell and the Java client.
As device, I use the OpenBench LogicSniffer device:
To start capturing, press the ‘Capture’ button:
This opens a dialog with the port settings. In the CodeWarrior project I’m using a serial port with 11500 baud:
To verify if communication with the works properly, the ‘Show device metadata’ button is used:
Make sure that the Freedom board is selected as device:
❗ It is important to select the correct device, as the configuration file defines the buffer size. If device/configuration does not match, then communication will fail.
Pressing the ‘Capture’ button will start getting the data from the KL25Z:
The captured data will show up:
The application on the FRDM-KL25Z is a combination of C code and Processor Expert components. I would love to create a Processor Expert component for the firmware (buffer settings, sampling rate, etc) as any of these changes need a manual change of the configuration file. I could generate that configuration file from the Processor Expert component to make things easier. Additionally, I do not support triggers yet (that would be great!). And a more flexible probe pin assignments would be good too (I’m using now 8bit/pins of PTC port).
I still love my I my Saleae Logic Analyzer: the software and hardware is simply superb! But for hobby projects I have now an open source alternative based on the Freedom board🙂. I cannot have the 50 MHz sampling as with the Saleae, but works well for many of my needs.