Author Topic: How to mesure baudrate of RS485 and "jitter" in signal  (Read 1760 times)

0 Members and 2 Guests are viewing this topic.

Offline SoramaTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: be
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #25 on: August 15, 2024, 11:04:33 am »
Recently I had to "decode" unknown differential protocol. I tried using my rigol scope but I faced the same issue as you, which is a lot of timing jitter. I am not certain what is causing this, might be just bad  triggering, but I am certain the device it is connected to samples it at the correct baud rate at the middle of each bit, with or without timing jitter. So, using logic analyzer really helps here as it basically emulates the slave, and it allows you to find patterns and perform quick testing of the protocol, much more comvinent. Next, figure out what is the start byte, as it will always repeat itself, and try to find if there is a CRC - this will help decoding the frame.

Any suggestion regarding a LA?

I still wonder wat the first packet is about (see screenshot): it has less bits than what follows later on.
Anyone who can translate that first sequence into binary?
I'm more of an analog guy, never got into digital.
« Last Edit: August 15, 2024, 11:16:34 am by Sorama »
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8775
  • Country: fi
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #26 on: August 15, 2024, 12:26:04 pm »
Try to decode by eye. That removes one "how to use this feature" uncertainty and forces you to find normal triggering conditions which consistently trigger to the start bit. And of course, first try to send just a single byte.

Automatic decoding is a convenience feature since decoding bits by eye is tedious for anything more than a few bytes.
 

Offline SoramaTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: be
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #27 on: August 15, 2024, 12:50:20 pm »
Try to decode by eye. That removes one "how to use this feature" uncertainty and forces you to find normal triggering conditions which consistently trigger to the start bit. And of course, first try to send just a single byte.

Automatic decoding is a convenience feature since decoding bits by eye is tedious for anything more than a few bytes.

I can’t send anything as it is a domotic system: besides the master system, I have control panels and relay boards but nothing that allows me to send a particular datagram.

I tried to decode by eye  this first byte attached, but as said, I don’t feel comfortable enough to be sure.
That’s why I would appreciate if someone else could, so that I can learn how to read it properly.
 

Offline rteodor

  • Regular Contributor
  • *
  • Posts: 170
  • Country: ro
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #28 on: August 15, 2024, 03:54:25 pm »
...
Anyone who can translate that first sequence into binary?
I'm more of an analog guy, never got into digital.

Is the width matching on all 6 chars ?
To me it looks like 0xA0 followed by a pause and then 5 times 0x00.

LE: For the first char I assume that is: 1 start bit + 8 bit data + 1 stop bit (classic 8N1).
Please check on the next ones if they have the same duration (cca. 460us 26us as it looks from over here).

With the above assumptions the bit is 46us 2.6us and that is a bit rate of about 21k 384615.
I would presume this is 19200 38400 8N1 but I need to see better measurements and more data.

LE2: I mixed up the timebases: so its more like 384000 bit rate (as somebody I think mentioned above).
« Last Edit: August 15, 2024, 04:28:19 pm by rteodor »
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3854
  • Country: nl
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #29 on: August 15, 2024, 04:53:01 pm »
Jitter is not so likely, but (semi) static differences in baudrates are unfortunately quite common.

For 8-bit data the maximums absolute error between the baudrates of receiver and transmitter is around 4.5% Start bit + 8 data + stop bit = 10 bits, and at the end you must have accumulated less then half a bit time of error.

And that error budget gets divided and eaten up in various ways.
* Laziness or incompetence for using the right crystal (Especially arduino is notorious for this. 16MHz is quite bad for most baudrates).
* Drift when using an internal RC oscillator clock. (Mostly drifts with temperature)
* Fractional baud rate generators (These introduce jitter in bit timing but also average out the error, and the total result is mostly quite acceptable)

Also, some manufacturers of equipment do about everything to reduce BOM cost. 20+ years ago I bought a PCI card with 2 serial ports, and it's baudrates were about 2.4% off. That's acceptable if the receiving end is perfect, but if the receiving end deviates by the same amount in the other direction then it does not work at all anymore.

Also, it does not matter whether you have a high or a low baudrate. If it's over 5% off between transmitter and receiver, then it simply does not work anymore. At lower baudrates you do have to set a bigger divisor in your uC, and this allows for a bit higher resolution in setting the baudrate, but it's not always enough. Atmel used to print big tables with usable baudrates in their datasheets (for example ATMEGA328) Fractional baudrate generators are much better in this regard. Resolution is high enough that any crystal can be used up to quite high baudrates, but there is a limit.

More modern communication standards use bit stuffing to guarantee that there is always a signal transition after a certain amount of bits, and this is combined with hardware to re-synchronize on the bits.
« Last Edit: August 15, 2024, 04:54:47 pm by Doctorandus_P »
 

Offline SoramaTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: be
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #30 on: August 18, 2024, 09:56:59 am »
...
Anyone who can translate that first sequence into binary?
I'm more of an analog guy, never got into digital.

Is the width matching on all 6 chars ?
To me it looks like 0xA0 followed by a pause and then 5 times 0x00.

LE: For the first char I assume that is: 1 start bit + 8 bit data + 1 stop bit (classic 8N1).
Please check on the next ones if they have the same duration (cca. 460us 26us as it looks from over here).

With the above assumptions the bit is 46us 2.6us and that is a bit rate of about 21k 384615.
I would presume this is 19200 38400 8N1 but I need to see better measurements and more data.

LE2: I mixed up the timebases: so its more like 384000 bit rate (as somebody I think mentioned above).

I'm sorry, I don't speak Hex :-)
I'm not sure I understand you at all: the baudrate is for sure 345600 baud.
What do you mean by six chars? Are you sure it is a total of six we're seeing here on the screen ?
The first (I don't know which term to use exactly,...diagram, char ?) is for sure an address (8 7 bits data + 1 parity): it never changes when I press a button on the (slave) control panel.

So would you mind to decipher all the bits (including start/stop) in this  "address" into binary ?

tnx.
« Last Edit: August 18, 2024, 10:53:16 am by Sorama »
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4345
  • Country: nl
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #31 on: August 18, 2024, 05:07:11 pm »
1010 0000 = A 0

Hexadecimal is very easy. 0 - 9 and A - F for 0 - 15 in decimal or 0000 - 1111 in binary.

Works the same as base 2, 8 or 10, but uses 16 as its base.

The scope image you provided was zoomed in on the first data set and in the zoomed out version you can see 5 sets of what appear to be all zeros.

Edit: The data goes from left to right.
start bit is low
most significant bit is high, then low, high, low, low, low, low, low
stop bit is high
« Last Edit: August 18, 2024, 05:10:55 pm by pcprogrammer »
 
The following users thanked this post: Sorama

Offline rteodor

  • Regular Contributor
  • *
  • Posts: 170
  • Country: ro
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #32 on: August 19, 2024, 04:57:43 pm »
I'm sorry, I don't speak Hex :-)
tnx.

"You must know that you have 16 fingers at your hands."
I had this joke on me and now I'm passing it on to you :)

You also must know: vertical cursors are your friend. Use them.
Is the following drawing helping you ?
2344673-0

 
The following users thanked this post: Sorama

Offline SoramaTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: be
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #33 on: August 20, 2024, 08:28:40 am »
@rteodor & @pcprogrammer,

Now I understand you :-)

tnx both of you for explaining this 'bit by bit".
Didn't know Hex was in two subsets.
Although I have an electronics degree (bachelor, 3 yr) from the late eighties, I can't even remember we talked about hex.
Hell, there is a lot I don't remember (anymore)  :-//

tnx again.

 

Offline rteodor

  • Regular Contributor
  • *
  • Posts: 170
  • Country: ro
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #34 on: August 20, 2024, 09:19:06 am »
Didn't know Hex was in two subsets.

They are often called nibbles.

Quote from: Sorama
Although I have an electronics degree (bachelor, 3 yr) from the late eighties, I can't even remember we talked about hex.
Hell, there is a lot I don't remember (anymore)  :-//

And still you are able to handle that scope well.
 

Offline SoramaTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: be
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #35 on: August 20, 2024, 09:53:01 am »
"And still you are able to handle that scope well."


Out of nostalgia I bought this Siglent 2104X Plus in 2021 but actually never used it  :palm:

Because suddenly I wanted to know how my domotic system works, I got the scope out a few days ago and started reading EEVblog forum.
I would love to get into electronics again (you never forget your first love, do you?), but I'm a building 'physicist' now (as a court expert).

Nevertheless, I might contact some companies (if there are any left) that do repair of boards as a freelancer (which I am since 1998).
Guess it doesn't pay as well as being a court expert.
Only one way to find out  :scared:
« Last Edit: August 20, 2024, 09:54:52 am by Sorama »
 

Offline PGPG

  • Regular Contributor
  • *
  • Posts: 229
  • Country: pl
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #36 on: August 20, 2024, 01:56:34 pm »
Didn't know Hex was in two subsets.

Not subsets but digits and nothing limits HEX numbers to two digits.

HEX number AA55 equals 43605 decimal and FFFFFFFF equals 4294967295.
You can use Windows standard Calculator application to check it.
Many years ago when buying calculator I selected CITIZEN SR-135 only because it has HEX numbers :)

And one note about decoding that transmission. Typically bytes are send low bit first. So the 1010 0000 would mean not A0 but 05 and if it is an address on bus it is more logical to expect number like 5 than 160 (=A0).
« Last Edit: August 20, 2024, 02:18:26 pm by PGPG »
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4345
  • Country: nl
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #37 on: August 20, 2024, 03:35:47 pm »
And one note about decoding that transmission. Typically bytes are send low bit first. So the 1010 0000 would mean not A0 but 05 and if it is an address on bus it is more logical to expect number like 5 than 160 (=A0).

Damned you are right. For SPI you can set the bit order and I2C uses msb first. Not sure if there are UART peripherals that allow you to change the bit order.

Offline m k

  • Super Contributor
  • ***
  • Posts: 2454
  • Country: fi
Re: How to mesure baudrate of RS485 and "jitter" in signal
« Reply #38 on: August 20, 2024, 03:53:40 pm »
Start bit is down, stop bit up and lsb first.

But from left to right is forward.
Advance-Aneng-Appa-AVO-Beckman-Danbridge-Data Tech-Fluke-General Radio-H. W. Sullivan-Heathkit-HP-Kaise-Kyoritsu-Leeds & Northrup-Mastech-OR-X-REO-Simpson-Sinclair-Tektronix-Tokyo Rikosha-Topward-Triplett-Tritron-YFE
(plus lesser brands from the work shop of the world)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf