Decoding UART Output

In this tutorial we will show how to use Analyzer2Go to quickly decode the captured UART output. Before you begin, follow the basic Analyzer2Go tutorial to ensure it works with your hardware.

We will use 2 boards in this tutorial: one STM32F4Discovery board will run a simple program that picks a random number, prints it to UART and waits for the corresponding amount of milliseconds. The other STM32F4Discovery board controlled by Analyzer2Go will be used as a logic analyzer. We will use it to capture the UART output and verify that the actual delays match the expected ones.

Before you begin, compile and download the following program into the generator board:

  1. Connect the UART signals (PA2/PA3) and the PA6 signal used to indicate the delay on the generator board to the inputs on the analyzer board and start Analyzer2Go. Enable signal capture on the channels you connected. You will see the randomly looking pulses on the PA6 and tightly packed sequences of pulses on the UART channel:
  2. Zoom in using the mouse wheel or by double-clicking on one of the pulse packs:
  3. The lower signal (PB2 in this example) is the UART output. You can get a low-level insight into it by selecting the shortest pulse and clicking the “1” icon to set its length as a reference pulse length:
  4. If you now select any portion of the UART output, Analyzer2Go will automatically split it into single bits based on the previously selected period and will display their values (e.g. 0 11001010 corresponds to a start bit followed by a value of 0x53 representing the capital ‘S’ letter):
  5. While looking at the bits manually may be useful for diagnosing complex timing issues, in most of the cases it would be unnecessary complex. Analyzer2Go provides a convenient mechanism of decoding the output manually. First, change the description of the PB2 signal to ‘TX’ so that Analyzer2Go can guess its meaning from the name. Then go to the Protocol Analyzers page and drag-and-drop the UART analyzer in the work area:It will automatically recognize the “TX” input and replace the raw signal there with decoded UART values.
  6. You can change various decoder settings (e.g. parity mode) in the Protocol Analyzers pane. Check the “Show all output as text” checkbox to automatically decode all of the UART output within the captured frame:Note how selecting text in the text area will automatically select the corresponding time span in the signal view.
  7. Select the pause after the “6 msec” message to verify that the board actually slept for 6 milliseconds:
  8. You can mark the checked area by adding a note to it (click the ‘add note’ button in the note bar):
  9. The note will be displayed in the scroll bar and in the signal view:
  10. If your signal does not require more bandwidth than the capturing board can provide, you can use the continuous capture mode to record gigabytes of logs. The protocol analyzers are optimized to work fast with large capture files and the text view will allow quickly looking through the captured output:
  11. Use the “Search” button to find events in the decoded output. The search is optimized to handle very large files and will run in the background:
  12. Once the message is found, Analyzer2Go will highlight it in both the text view and the signal view so you can quickly lookup other nearby events: