Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post discussions on projects you are working on
Post Reply
__alex__
Newbie
Posts: 0
Joined: Thu Nov 17, 2022 12:23 pm

Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by __alex__ »

Hello,
I am currently driving a 2205A MSO via python-script. The idea is, to create a sniffer for a custom UART-protocol for later interpretation of it. I was able to setup the two digital inputs D0 and D1 of port0 to receive data via block mode. With the function "splitMSODataFast", I was able to receive separate data for each digital input of port0 consistion of only 0 and 1. Now, I would first have to interpret received data considering the used sampling rate. e.g: If I use a sampling rate of 4*UART-Baudrate, ideally four zeros would mean 1 zero of the protocol. I don't really like this approach. Therefore I want to ask if it is possible for each channel to only receive data at a falling and rising edge of the input data. To determine whether the protocol data has sent e.g. 5 zeros or ones in a row, I'd need some kind of timestamp.
If I can provide any further information, please let me know.

bennog
Advanced User
Advanced User
Posts: 206
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by bennog »

Are you sure you want to use python ?
Because then you do need to do the decoding yourselves.

If you do it in picoscope you can set alarms to save the data to a file and see the signal visually and export it to CSV or something to analyse in some program.

If you do it in python you need to build the visualizer and decoder self.

Benno

__alex__
Newbie
Posts: 0
Joined: Thu Nov 17, 2022 12:23 pm

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by __alex__ »

Hey Benno,
thanks for your advice. The decoder itself is already finished and will be used in an automated testing environment. My hope was that the picoscope could be integrated into this environment and what basically is only missing at that point is the data output from the scope which I mentioned.

__alex__
Newbie
Posts: 0
Joined: Thu Nov 17, 2022 12:23 pm

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by __alex__ »

Hi, thanks for the suggestion. But the entire data decoder-module in python is already finished. It also does not need to be a live-decode. So I gather data, and after I gathered data, I decode the data.

bennog
Advanced User
Advanced User
Posts: 206
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by bennog »

You can use streaming mode and do the triggering yourself.

I have done this for a CAN signal where we want to trigger on a specific message-corruption ant this was streaming at 4MS/sec.
I guess your UART baud rate is below 500kbps. If it is above a 2000 series scope will probably not handle this in streaming mode.

Benno

__alex__
Newbie
Posts: 0
Joined: Thu Nov 17, 2022 12:23 pm

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by __alex__ »

What exactly do you mean with "do the triggering yourself?" Do you mean deactivating the scopes' triggering and trigger by getting streaming data?

bennog
Advanced User
Advanced User
Posts: 206
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by bennog »

In streaming mode you get a constant stream of data from the scope for as long as you want.
Then you can evaluate the data while it is streaming into your application and when you see the data pattern you want save the part from that point on or data before that point and the length you want as often as you want.

Then you never have gaps in your data. The only limit is the max streaming data speed of the scope.
If I remember correctly the 2000 series have a somewhat limited max streaming speed.

Benno

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by Martyn »

What baud rate is your signal, and have you tried setting the sampling rate to the baud rate?

For information the 2205A MSO has a maximum sampling rate shared between active channels of 1MS/sec, one digital port of 8 digital channels is considered as a single active channel.
Martyn
Technical Support Manager

__alex__
Newbie
Posts: 0
Joined: Thu Nov 17, 2022 12:23 pm

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by __alex__ »

"What baud rate is your signal"
It will be at 576000 baud.
"and have you tried setting the sampling rate to the baud rate?"
That was my first try, yes. If I am not wrong, I can not exactly set the sampling rate to the value 576000.
I am currently testing the scope measurement by creating rectangular signals with a Frequency of baud/2 and a duty cycle of 50%. The results' reliability is okay. With an oversampling x*baudrate, I receive x+-1 samples for each flank. My hope was to eliminate these x+-1 samples to exactly x because for testing the actual DUT later on, I want to be able to clarify if such bit errors are created by the DUT and not by the measuring system.
For information the 2205A MSO has a maximum sampling rate shared between active channels of 1MS/sec, one digital port of 8 digital channels is considered as a single active channel.
I will test two data lines, so I need to use two channels.

__alex__
Newbie
Posts: 0
Joined: Thu Nov 17, 2022 12:23 pm

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by __alex__ »

maximum sampling rate shared between active channels of 1MS/sec
Are you sure about that? The Picoscope 2000 Series Programmer's Guide shows a minimum sample interval of 10ns which would mean 100MS/sec

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by Martyn »

Are you sure about that? The Picoscope 2000 Series Programmer's Guide shows a minimum sample interval of 10ns which would mean 100MS/sec
100MS/sec is available in block mode captures where the data is stored in the internal memory of the device before being transferred to the PC, the 2205A MSO only has a 48kSample memory buffer so wouldn't be able to capture much data.

The 1MS/sec refers to streaming mode where data is transferred directly to the PC over the USB bus, and it can do this continuously for extended periods of time. The 48kSample memory on the device is only used as a FIFO to prevent data loss.
Martyn
Technical Support Manager

__alex__
Newbie
Posts: 0
Joined: Thu Nov 17, 2022 12:23 pm

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by __alex__ »

So that basically means that this scope is unsuitable since with two data lines I have only 500kS/s available? That's a bummer

bennog
Advanced User
Advanced User
Posts: 206
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by bennog »

You can use block mode but then you will have the limit of max 48k samples and you need the scope trigger functionality.

but 500kS/sec is more than sufficient for 57600 baud (or do you really mean 5.7mbaud)

can you post a psdata where you show what you want to trigger on.

Benno

__alex__
Newbie
Posts: 0
Joined: Thu Nov 17, 2022 12:23 pm

Re: Logic analyzer data: Only receive triggered data (with timestamp) using Python

Post by __alex__ »

Hey bennog.
bennog wrote:
Fri Nov 18, 2022 4:14 pm
You can use block mode but then you will have the limit of max 48k
The protocol has a length of 32bytes and is being sent quite rapidly. So the Scope can buffer about 185 protocols. I am not sure this will be enough yet.
but 500kS/sec is more than sufficient for 57600 baud (or do you really mean 5.7mbaud
)
It has a Baudrate of 576000 bit/s, so 0,576MBaud = 0,576MBit/s, whereas the maximum sampling rate I can get is 500kS/s.

Post Reply