DS203: LA104 OS update – new oscilloscope features, calibration and test apps, FPGA built with open-source tools

Hi all,

here is a new build of the LA104 OS for the DS203 HW 2.6x / 2.7x
(iCE65L04 FPGA, STM32F103VE). It includes a much improved oscilloscope app,
two new apps for calibration and FPGA testing, and a new FPGA image,
2.67, which is synthesized entirely with open-source tools. No
Lattice iCEcube2 was used.

Everything is in my fork: GitHub - Kuzma30/LA104: LA104 logic analyser alternative firmware and experiments · GitHub
The ready-to-flash archive (OS, FPGA image, apps, instructions) is here

https://github.com/user-attachments/files/35070832/LA104-DS203-2026-11-18.zip


Oscilloscope (miniosc.elf / gabmini)

Measurements and analysis

  • Automatic setup (F3): picks V/div, position, time base and trigger for the signal on CH1/CH2.
  • Meas tab: four automatic measurements at once.
    • Vpp, Vmax, Vmin, Vavg, Vrms
    • Freq, Period, Duty, pulse widths
    • Rise / Fall
    • Delay and Phase CH1 → CH2
    • FreqHW, from the FPGA edge counters
  • Statistics for the selected measurement: count, min, max and mean.
  • Tools tab:
    • Math (A+B, A−B, B−A, A×B)
    • FFT (Hann window, peak readout)
    • Reference trace
    • Save CSV and Save BMP (screenshot) to the device disk

Display

  • Cursors with real units that follow the time base (ns … s), plus 1/dX.
  • Beam width 1–3 px per channel, like the focus knob of an analog scope.
  • Fill mode shades the area between the trace and the channel’s 0 V level.
  • T-Y or X-Y (Lissajous), persistence and phosphor mode.
  • TRIG / WAIT indicator in Norm / Single, so a frozen old frame is not mistaken for a new one.
  • Roll display in Scan mode at 50 ms/div and slower; time base up to 1 s/div.
  • Buffer of one screen for much faster frame rates, or the full 4096 samples.

Decoders: UART, SPI, I2C, CAN, LIN, 1-Wire, WS2812, NEC, PS/2, pulses, plus a pulse counter and a quadrature encoder decoder.

Calibration: Tools → Zero cal measures the 0 V level of every V/div range on both channels. It takes the mean over 60 ms, so 50/60 Hz hum cancels out, and measures at three positions. The result is saved to MINICAL.CFG.

Under the hood

  • The app grew past the 100 KB slot below the FPGA bitstream. On the DS203 it now runs from 0x08040000.
  • The 12 KB sample buffer lives in the 16 KB of RAM that the OS does not use (0x2000C000).

New apps

minical.elf – manual calibration (MiniCal)

  • Shows a table of zero and gain for every V/div range of CH1 and CH2, with a live measurement of the selected channel and range.
  • Auto zero: probe on ground.
  • Auto gain: put a known DC voltage on the input and enter it as “Ref”.
  • Fine tuning with the keys, then save / reload / defaults.
  • Writes the same MINICAL.CFG that the oscilloscope reads. The file format now also carries the gain of every range.

fpgatest.elf – FPGA tester

  • Automatic tests driven by the Wave Out signal:
    • edge counters of all four inputs (on C/D a 100 000-pulse burst is counted exactly, square bursts are checked up to 9 MHz);
    • quadrature decoders;
    • oscilloscope triggers in all modes on CH A / CH B.
  • Live pages for the counters and the encoder.
  • The trigger tests also run on the original FPGA 2.61, for comparison.

fpgaload.elf – FPGA loader

  • Loads an FPGA image from the disk into the FPGA for a quick test (until power off).
  • Saves the current boot image to a file and writes a new one into the flash, without DFU or a PC.
  • Tested on hardware; a broken boot image can always be restored with DFU.

FPGA 2.67, synthesized with open tools

The DS203 FPGA is a Lattice iCE65L04. The open-source flow (Yosys, nextpnr, IceStorm) supports only iCE40, and so far only the vendor iCEcube2 could build bitstreams for this chip. I added experimental iCE65 L04 support to IceStorm and nextpnr. The toolchain with setup scripts and instructions is here: GitHub - Kuzma30/ice65-opentools · GitHub

On top of the original 2.5/2.61 oscilloscope logic, the 2.67 image adds:

  • 32-bit edge counters on CH C / CH D, read straight from the pins;
  • edge counters on CH A / CH B, from the comparators in the sampling clock;
  • two quadrature decoders, encoder A/B/Z on any input.

It also fixes the trigger at fast time bases (36/72 MHz sampling): the ADC and digital inputs are registered right at the pins, and the trigger comparators are pipelined. The captured data and the trigger point are identical to the original FPGA.

All of this is verified by an Icarus Verilog testbench that compares against the original design, and on hardware with fpgatest. Both triggers and counters pass on my DS203 (V2.7 board).

The Verilog sources, the testbench and the build scripts are in system/fpga_ds203 of the repository. The original image is included in the archive for going back.

Installation (short version)

  1. OS: hold the first button while switching on to enter the DFU disk, then copy firmware/system_ds203.hex.
  2. FPGA 2.67: in DFU, copy fpga/V267/CFG_FPGA.ADR, then V267FPGA.BIN (or write it with fpgaload).
  3. Apps: start normally and copy everything from disk/ to the root of the device disk.
  4. Calibrate once: in miniosc run Tools → Zero cal; optionally set the gain in minical.

The full instructions are in README.md inside the archive.

Requirements and notes

  • Needs the 512 KB flash / 64 KB RAM STM32F103VE (DS203 HW 2.6x / 2.7x).
  • The factory DFU/SYS, the factory calibration and the FPGA area are never overwritten by the OS.
  • To go back, flash the original FPGA 2.61 from the archive and your original APP.

Feedback and test reports from other hardware revisions are very welcome. Please report problems on the GitHub issues of the fork.