Jump to content
  • 1

Parsing Logic Analyzer with Script?


John Kozell

Question

Hi folks,

I'm currently hacking a 433Mhz temperature probe, and attempting to intercept the reading using a standard 433Mhz receiver, such as the Sparkfun RF Link Receiver.

Using WaveForms (desktop) I can record the Logic Analyzer output, and can see the single fine. I'm currently in the process of parsing the bit stream. The signal is repeated every 59 seconds. However I need more samples, and the manual translation of the square wave to 0/1's is tedious and time consuming (and error prone).

I'd like to create a script that will read the 'repeated' (not recorded, realtime) Logic1 data, look for the periodic transmission bursts, convert the encoded waves to a binary character stream (ex: "0101001010") and print it to the screen (or log to file).

Is this approach possible, in the way I'm thinking of it? Or is there an easier/better way to approach it?

Also, I haven't been able to find many Script samples around the Logic# object. I understand it is similar to the Scope# (for example), but still a closer sample wound be great.

Any tips/suggestions?

Thanks

-John

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Thanks Attila & hlipka. Sorry for the delay in replying.

Yes, hlipka, that's what I ended up doing. The signal I was monitoring has allot of noise, so I was worried about logging too much garbage, and I might have trouble locating the signal.

But I learned that the Logic Analyzer can be triggered, and configured to write a log file only when being triggered - that helped allot. So I was able to trigger, then write the file.

I created a .NET C# Console application to read the file, and used Reactive Extensions to crush the stream into a bursts of 1's & zero's, something like this:

                var acquisition = Samples.ToObservable(NewThreadScheduler.Default)
                    .DistinctUntilChanged(s => s.Value) // Filter out any adjacent high/lows, stream will alternate now.
                    .SkipWhile(s => s.Value != 0) // Make sure the first item is a zero, so we can calculate low durations.
                    .Buffer(2) // Convert single stream into stream of pairs, each having a high then low reading.
                    .Where(p => p.Count > 1) // Make sure entire stream is just pairs, drop the last if it is a singleton.
                    .Select(p => p[1].Time - p[0].Time) // Convert the high/low pairs, into a single measurement of the low duration.
                    .SkipWhile(d => d >= PREAMBLE_LOW_DURATION) // Ignore any pulses before the preamble.
                    .TakeWhile(d => d < PREAMBLE_LOW_DURATION) // Truncate the readings after the next preable.
                    .Select(d => d < _onesThreashold ? SHORT_SYMBOL : LONG_SYMBOL) // Differentiate between long and short pulses, code as 0/1.
                    .Scan((a, b) => a + b) // Concatinate bits into string (bits are reversed, LSB first).
                    .TakeLast(1) // The stream will only have 1 element, take that.
                    .ToArray(); // Convert to simple array. Didn't find a way to just return the first/only element of a stream.

Got a nice output, and created a list of samples that I could analyze. 

Still, I think it would be cool to be able to trigger a script from the Logic Analyzer, can this be done?

-John

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...