Serial port debug

When developing firmware, it’s nice to have a serial debug port. By adding a little software, you can get information about the current operating state, “how much heap space have I used – heap?”, or exercise parts of your design, “set the motor to run at 50% – mot 50”, or tweak parameters of a PID loop to see the effect on system behavior.

Of course you have to first turn on and debug the serial port and parser before you can use it. Common issues are getting the serial inputs/outputs connected correctly and correct setup of the baud rate on your microprocessor. This is where Live Logic can help.

Live Logic provides high performance digital capture with easy to use scope probes. First, connect the probes to the Rx and Tx pins on your board. Live logic includes a DVM and you should immediately note that the Rx and Tx lines are high – close to the positive supply rail.

Next you can verify that The microprocessor serial input is connected to the terminals Tx output. Start the terminal program and hit the enter button a couple of times. The Live Logic activity LEDs will flash indicating activity on the channel connected to the terminal Tx line. Verify that this is the serial input pin to the microprocessor.

Finally, you want to verify that the baud rate for the terminal and the microprocessor UART are correct. Set Live Logic to single, SAMPLES to 512, and start a Live Logic capture. When you hit enter on the terminal you should see the Live Logic channel activity light flash and if your parser is working the Rx channel activity LED should also flash. Stop the acquisition and you should see spikes in the data display. These are the logic activity on the Rx and Tx lines.

Live Logic can capture up to 45 minutes of signal activity. In this case, it captured the entire time span from when you clicked start until you clicked stop. The width of the serial activity is very small compared to your capture time, more than 6 seconds. To see the serial activity, we will have to zoom in on the spikes.

To verify that the baud rate is correct, 38,400 in this example, we can zoom in further and use the A/B marks to measure the narrowest bit. To switch between time and frequency measurement just click ‘/’ on the keyboard.

The measurement is 1/dt=38.45KHz. We have the right baud rate programmed.

Live Logic can help you to quickly get a serial debug port up and running. Its long time capture eliminates the need to set up a trigger to capture the serial transaction. The DVM, activity LEDs, and A/B measurements make it easy to verify your connections and baud rate. The high sample resolution, 2.5 nanoseconds, ensures that the measurement is accurate, even at high baud rates.