Tinnef space

Tinnef {m} [ugs.] - trash [worthless stuff]

Logic Analyzer Progress

Here I will list all the planned steps for my logic analyzer and document my progress as I go on.

General facts:

  • STM32F103C8 (“bluepill”) microcontroller
  • opencm3 framework as a base for the firmware
  • Arduino as a base for the firmware
  • Firmware is based around the extended SUMP protocol
  • PulseView/sigrok as frontend
  • USB-CDC for communication between ┬ÁC and PulseView
  • 1 Stage Trigger for now (only Logic Level)
  • Name: BLA - Bluepill Logic Analyzer


  • Setup dev environment, repository and blinky firmware.
  • Working UART over USB-CDC. Read/Write Bytes successfully
  • General SUMP Logic working
  • SPI + 23LC1024 SRAM setup
  • Attach a transparent Latch to the SRAM input
  • Use SRAM to store samples
  • Trigger working
  • Aquire maximum samplerate through tests

Setup dev environment, repository and blinky firmware

The first tiny step is done. The project can now be found here:


Working UART over USB-CDC

Been there, done that. I tried to keep this one as simple as possible. Used the code from an existing sketch I did some time ago[1], just put it into a separate module. The usb_init function gets a callback handed over which gets called when new data is available. After that the usb has to be polled in the main while(1). This looks like this:

    int myCB(char *buf, uint32_t len) {}

    int main() 
        usbd_device *dev = usb_init(myCB);
        while(1) {

This handles all the needed functionality. To test this I made a simple python3-sketch and it works just fine:

#!/usr/bin/env python3

import time
import serial

port = "/dev/ttyACM0"

ser = serial.Serial(port, baudrate=115200,
        bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE,

ser.read_all()  # clear buffer

ser.write([0x01])  # led on
tmp = ser.read_all()

ser.write([0x00])  # led off
tmp = ser.read_all()


usb working image

blinky gif

Keep it simple, stupid

Yesterday night and this morning I was having some issues with getting the timers correct working using opencm3. It got me kinda frustrated and I wanted to quit. Then I thought about it and realized that there is lots of Arduino stuff for the Bluepill controller. So now I ported everything to Arduino and it looks like it does work. Atleast for a 1ms blinky sketch.

blinky analyzing

Also I reorganized my tasks, because I got stuck on opencm3+SPI yesterday, too. So I will implement all logic first using the internal SRAM, a low samplerate and about only 16k samples. Afterwards I will try to attach the extarnal SRAM and bump the speed.

Right now the logic implementation task is almost done, just having some issues with the packet count, which PulseView gets somehow incorrect, but I will get that.

The git repository will be updated quite soon with the Arduino Code.

Never Give Up!

SUMP Logic working. PulseView connection successful.

Great news! All of the basic SUMP-Logic is working. No trigger yet. I can even get correct readings for up to 500kHz samplerate, which is fucking great! Pic related. The only thing is that I don’t get the correct amount of expected packages (also on the picture). But I won’t care that much about this right now. Will attach the SRAM now and later look into that.

500k samplerate

Also I have redone the repository now. The Arduino code up until now can be found in there.