Logic Analyzer!

…and not only software (maybe).

OK, to keep things short, I got tired by limitations of my Saleae logic analyzer, especially on the software side so I decided to build one. This is my new project: a DIY logic analyzer that I will hopefully use to better extent in my other projects.

First results promising. I built the communication prototype and tested the connection with a rudimentary packet transmission from an Arduino, sending just letter “U”:

#include <stdlib.h>
#include <stdio.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <util/delay.h>

#define FOSC 16000000
#define BAUD 9600
#define MYUBRR (unsigned int)(FOSC/16/BAUD-1)

void USART_init(unsigned int ubrr)
    /* Set the baud rate */
    UBRR0H = (ubrr >> 8);
    UBRR0L = ubrr;

    // Enable receiver and transmitter
    UCSR0A = (0<<U2X0);
    UCSR0B = (1<<RXEN0) | (1<<TXEN0);

    // frame format 8N1
    UCSR0C = (1<<USBS0) | (1<<UCSZ00) | (1<<UCSZ01);

void USART_write(unsigned char data)
    while ( !(UCSR0A & (1 << UDRE0)) )
    UDR0 = data;

int main (void)
    char i = 0;
    char *str = "U";

    /* prep calc */
    USART_init( MYUBRR );

    while (1) {
        if (str[i] == '\0') {
            i = 0;
    return 0;

The result on the software side:

Letter "U", 4 pixel wide segment
Letter “U”, 4 pixel wide segment

And modified with a segment of 10 pixels:

Letter "U", 10 pixel wide segment
Letter “U”, 10 pixel wide segment: this should be the effect of zooming, not implemented yet.

For now zooming is not implemented (actually I have an entire list of what this should accomplish), but will be soon. Sending a longer string to demonstrate scrolling:

int main (void)
    char i = 0;
    char *str = "1234567890qwdefrgthbvcdf fgt h n";

    /* prep calc */
    USART_init( MYUBRR );
A more complex string
Sending “1234567890qwdefrgthbvcdf fgt h n” mumbo jumbo (30 chars) displays ok…
A more complex string
… and horizontal scrolling works.

Not too complex so far, but basics work: serial communication, packet send and byte flip via mask (there is an option for MSB/LSB first), but I have a long list of features that I want to accommodate with this, mostly those missing on my Saleae Logic stuff:

  • Possibility to combine triggers for different channels
  • Trigger on slope, level, duration and byte
  • Find a specific byte or sequence of bytes and zoom into
  • Add bus visualization and possibility to combine channels to a bus (supported partially by Saleae but only for one parallel protocol and not natively)
  • Table display (separate) of each packet data, sorting, selecting filtering by packets
  • Add triggers to selected packets in data table
  • Accomodate pattern trigger
  • Accomodate holdoffs
  • Adding more measurement cursors (for God’s sake, Saleae, is this so difficult to make ? why to cripple your app)
  • Possibility to combine measurements from different cursor readings (on various intervals)
  • A better value display; Saleae’s apps looks cool, but those ovals make me nuts ! Standard cornered bezels would’ve been better

That’s just a part of it, but the coding is extensive. I will update as progress is unravelling. 😉


Leave a Reply

Your email address will not be published. Required fields are marked *