New trigger specification

From sigrok
Jump to: navigation, search

Currently libsigrok supports only a very basic trigger specification. Triggers are expressed as a string, in the format which sigrok-cli supports (it passes it on unchanged to libsigrok). The format is <probe>=<trigger>, where <probe> is the name of number of the probe and <trigger> can be:

  • 0 or 1: low or high value on the pin. A series of these specifies a sequence of values the probe must match before the trigger is considered to fire.
  • r or f: A rising or falling value on the pin. An r effectively corresponds to 01.
  • c: Any kind of change on a pin (either a rising or a falling edge).

However, there are some problems with this:

  • It's not a very precise specification. For example, there is no way to specify that either this probe should match its trigger, OR another probe should.
  • It's not very expressive, and only allows for very simple triggers to be specified. Some hardware supported by sigrok is capable of much more complex triggering.
  • A text-based specification will only go so far before it becomes more of a problem to parse than the convenience it provides to the CLI frontend.

This page attempts to provide a work document where requirements and design ideas can be gathered before a new trigger specification is implemented in libsigrok.

Trigger support examples

Asix Sigma/Sigma2

The following triggers are supported by the hardware:

  • Defined duration of the condition ("longer than" and/or "shorter than")
  • Sequence of two different conditions
  • 16-bit counter - triggering after N-th occurence of the condition
  • Extensive condition definition options using logical functions (N)AND,(N)OR,(N)XOR
  • Any value or edge on any input condition

Openbench Logic Sniffer

Wishlist

Trigger types

This should be a (long) list of all types of triggers and trigger combinations we want to support in sigrok.

  • Edge:
    • Rising edge
    • Falling edge
    • Either rising or falling edge
  • Level:
    • Low signal value
    • High signal value
  • Width/duration
  • ...

Combinations:

  • ...

Logic operations:

  • ...

Special-purpose:

  • ...

Protocol decoder triggering:

  • ...

Features

The system should support specifying

  • Hardware triggers (that are used to configure the respective device to use its own internal hardware-based triggering)
    • Note: Some devices do not support internal/hardware triggers at all. Those will use software triggers only.
  • Software triggers (that are implemented in libsigrok/libsigrokdecode and can run after the hardware triggers)
  • A combination of software and hardware triggers
  • ...