Serial decode issue

Post any questions related to the new PicoScope 7 software
Post Reply
petermcs
Newbie
Posts: 0
Joined: Tue Dec 19, 2023 9:35 am

Serial decode issue

Post by petermcs »

Hi,

I've an odd one here...

I'm decoding an RS485 data stream at 9600, n, 8, 1 and the master device always decodes ok but I get bad decodes on the response data.

The master device has a nice symmetric signal on the lengths of the 1s and 0s but the response data wave forms are slightly different. At 9600 the bit length is just over 104us. If you get a single 1 bit with a 0 either side the bit width is about 119us and a single 0 bit with a 1 either side is about 89us. If you have a 1 and a 0 together the total is the expected 208us so basically the isolated 0 bit on the wire is asymmetric but it is padded to always keep the proper bit time.

The basic idea with asynch comms is you are supposed to make your value decision in the middle of a bit cell and so it should not matter if an isolated 0 is "shorter" as long as it is positioned correctly in the time slot.

The serial decode works fine with this for the most part unless the first two bits in the start of a byte are 1 followed by a 0 and the bytes are back to back. In this case the serial decoder seems to look at the slightly short 0 start bit and decides it is not the start of the byte and gets out of synch until either the next "valid" start bit or the first pair of 0s which it then assumes is a start bit.

Has anyone come across this issue before?

Regards,
Peter

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

Re: Serial decode issue

Post by Martyn »

Can you post a psdata file showing this.
Martyn
Technical Support Manager

petermcs
Newbie
Posts: 0
Joined: Tue Dec 19, 2023 9:35 am

Re: Serial decode issue

Post by petermcs »

The file I have is very large at 77MB so I can't upload it. Is there a way to save a section of a captured waveform as I'm not on site anymore and it requires a plane trip to get there!

petermcs
Newbie
Posts: 0
Joined: Tue Dec 19, 2023 9:35 am

Re: Serial decode issue

Post by petermcs »

I noticed that the master packet had decode errors too one one capture but far fewer. When I looked at these, the differences in time were less than a us. I had the threshold set to 2V and there is a bit of a noticible rise and fall time on the signals due to cable lengths etc so I adjusted the threshold to 1 v to make the pulse slightly larger which worked in that instance. We are talking going from 103.4us at the 2V point to maybe 104.5 at the 1V point here.

It looks like the timing window for the start bit is set very tight...

petermcs
Newbie
Posts: 0
Joined: Tue Dec 19, 2023 9:35 am

Re: Serial decode issue

Post by petermcs »

Best I can do is a couple of screen captures showing one of the failures with the measurements for the start bit and following 1 bit - waveform is reversed as I was capturing from an RS485 line and picked the wrong polarity when connecting my probe...
Attachments
wide 1.png
narrow 0.png

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

Re: Serial decode issue

Post by bennog »

looks like your baud-rate is a bit off.
Hard to tell without a .psdata file.

you can try using a wetransfer link for the .psdata because it is far to big for the forum to post.

Benno

petermcs
Newbie
Posts: 0
Joined: Tue Dec 19, 2023 9:35 am

Re: Serial decode issue

Post by petermcs »

I think the baud rate is ok but the start bit detection in the asynch serial decode is just a bit too sensitive. It gets confused with relatively small changes in the timing as you can see from the above images and is completely thrown by the non symmetric 0/1 bit timing for the responses.

Peter

petermcs
Newbie
Posts: 0
Joined: Tue Dec 19, 2023 9:35 am

Re: Serial decode issue

Post by petermcs »

Last edited by petermcs on Thu Dec 21, 2023 1:51 pm, edited 1 time in total.

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

Re: Serial decode issue

Post by Martyn »

If you select decode between time rulers and then place the cursors as shown, the framing errors disappear.
BetweenCursors.png
When you enable serial decoding it downsamples data to process, as you have plenty of trace with no data with your settings this results in around 5 samples per bit of the serial data which is too low, hence the sample rate too low message
SampleRateTooLow.png
SampleRateTooLow.png (9.98 KiB) Viewed 128415 times
If you select between cursors it downsamples the selected region, has many more samples per bit, and can process the data.

You could just move the trigger to 10% and change the timebase to 5S/div , but this would depend upon other data you need to collect.

Hope this helps.
Martyn
Technical Support Manager

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

Re: Serial decode issue

Post by bennog »

He is sampling at 500kS / sec so it is 50 samples per bit
This should be enough.

P.S. I misunderstood the downsampling. why is that ?
is this also true for CAN bus ?

Benno
Last edited by bennog on Fri Dec 22, 2023 10:20 am, edited 1 time in total.

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

Re: Serial decode issue

Post by bennog »

It looks like the problem is the pulses are not symmetric High = 102us = 9800 Hz Low = 106us = 9400 Hz
I don't have the RS232/485 specs in my head what the variation is allowed in these timings.
But somehow the picoscope software is very picky about the bit timing and missing te start bits.

Benno

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

Re: Serial decode issue

Post by Martyn »

The Serial Decoder only pulls down 20MSamples for decoding, the data is downsampled on the device, so even though the device is sampling at 500kSamples/second you won't get that for decoding.

The full buffer contains 250MSamples so 20MSamples for decoding means you are getting less than 5 samples per bit not the 50 samples.

If you decoder between rulers, and set the rulers as I have shown, you are getting 20MSamples across a tenth of the overall time which is why it can then decode correctly.

We are currently investigating this limit to see what impact it will have on performance if we increase it.
Martyn
Technical Support Manager

petermcs
Newbie
Posts: 0
Joined: Tue Dec 19, 2023 9:35 am

Re: Serial decode issue

Post by petermcs »

Excellent Martyn! That's sorted it perfectly.
I can see what you mean in terms of the buffer used for analysis and the down sampling which means the slight changes in the timing for the bits can be come large if they are at a sample boundary...

Thanks for your help with this.

Peter

Post Reply