Projects

Logic Analyzer

published 2021-08-05

Overview

This is technically a logic analyzer. It analyzes logic in order to extract information. However, in practice it is more of a "baud rate detector."

So at one point I was opening up some electronic device (I don't remember what) and I wanted to connect the UART on the board to my laptop. I didn't know the baud rate though. So rather than spending an hour at most figuring it out through trial and error, I decided to spend much more time making a device that would figure out the baud rate for me.

The first iteration used the number of voltage changes per second in order to calculate the baud rate. Unfortunately this meant that it only worked when the bytes being sent were 01010101 or 10101010. This got me close enough to the actual baud rate (since there are only so many that are common) that I was able to connect to the device through, so it worked well enough for me.

But it could be better. What if in the future I wanted to know the exact baud rate of something that used a nonstandard baud rate? And so I planned out a second iteration. This iteration would look for the smallest distance between two voltage changes on the data line and calculate the baud rate solely on that. That would make it so that as long as there was some sequence of 010 or 101 it would be able to calculate the baud rate, which is pretty likely if you sample over multiple bits. I haven't gotten around to implementing this yet, however it should work on the current hardware.

Both the firmware, schematics, and KiCad files can be found here

Tech Used

This project was built around the MC9S08SH8 microprocessor. This 8-bit microprocessor was more than powerful enough for this project, and using an external clock it was also precise enough.

For programming and development I used NXP's Codewarrior platform with Processor Expert.

The design of the PCB for the project was done in KiCad, which I had fabricated by OSH Park.

What I Learned

This project has been (at the time of writing this) the largest learning experience I think I've had. Prior to this I had never done anything with PCB design or fabrication, external interrupts on microprocessors, used things like external oscillators, or have to think about uber-precise timing in code.

Having completed it I now have an at least adequate understanding of these things, and am definitely a much more competent programmer in Embedded C.