Author Topic: Differential Bi phase Level Decoder  (Read 439 times)

0 Members and 1 Guest are viewing this topic.

Offline man_marius

  • Contributor
  • Posts: 16
  • Country: be
Differential Bi phase Level Decoder
« on: October 18, 2018, 06:04:19 pm »
What is the easiest way to go about make a Differential Bi phase Level detector circuit board, with discrete components or FPGA,

The decoding works in two steps, first translating phase shift bit shift into A letter, this happens in the center of each bit cell, a change from -1 to 1 is encoded as "A" and a change form 1 to -1 is encoded as "B".
The second step is to compare the current letter to the previous one
 X current = X previous  -> 1 is encoded
 X current != X previous -> 0  is encoded

I have attached the encoder schematic
 
 

Offline man_marius

  • Contributor
  • Posts: 16
  • Country: be
Re: Differential Bi phase Level Decoder
« Reply #1 on: October 18, 2018, 06:12:37 pm »
The  input signal is a polarity insensitive differential line 120 characteristic impedance and at a datarate of 564.48 kbit/s
 

Offline Dubbie

  • Supporter
  • ****
  • Posts: 839
Re: Differential Bi phase Level Decoder
« Reply #2 on: October 18, 2018, 06:17:38 pm »
I have just done a biphase mark decoder using an stm32 micro. I just start a timer on an edge interrupt and then add the timing of the last edge to a fifo buffer that gets processed in the main loop. Seems to be reliable. However I am only decoding up to 4kb/s. I am doing a lot of other stuff on the micro such as drawing an oled screen and writing to an sd card and everything plays well together.
 

Offline man_marius

  • Contributor
  • Posts: 16
  • Country: be
Re: Differential Bi phase Level Decoder
« Reply #3 on: October 18, 2018, 06:26:09 pm »
That would work, but that is dependant on how fast the micro controller is running
 

Offline Dubbie

  • Supporter
  • ****
  • Posts: 839
Re: Differential Bi phase Level Decoder
« Reply #4 on: October 18, 2018, 06:45:41 pm »
Have you got any experience with fpgas? This would be pretty simple to implement on one. Kinda seems like overkill almost though. Maybe a cpld? Or get one of those soc micros with the built in clpd.
 

Offline man_marius

  • Contributor
  • Posts: 16
  • Country: be
Re: Differential Bi phase Level Decoder
« Reply #5 on: October 18, 2018, 07:11:38 pm »
I have one, but I want a standalone system, the board I have is zynq and it will be overkill
 

Offline man_marius

  • Contributor
  • Posts: 16
  • Country: be
Re: Differential Bi phase Level Decoder
« Reply #6 on: October 18, 2018, 07:12:33 pm »
can it be done use discrete components, it is better
 

Offline Dubbie

  • Supporter
  • ****
  • Posts: 839
Re: Differential Bi phase Level Decoder
« Reply #7 on: October 18, 2018, 07:20:50 pm »
You could make it out of a fistful of 74 series logic
 

Offline KrudyZ

  • Regular Contributor
  • *
  • Posts: 128
  • Country: us
Re: Differential Bi phase Level Decoder
« Reply #8 on: October 18, 2018, 07:56:40 pm »
If you have a synchronous clock, then it's trivial.
In the likely event that you don't have that, you would either need to do clock recovery or oversampling.
Since your data rate is fairly low, I would suggest to oversample the data to recover the bits.
Use a couple of flops to remove metastability from the synchronizing stage.
Then detect edges by comparing two consecutive samples.
Start a counter when you see an edge and measure clock cycles to the next edge.
Use a window comparison to figure out if you just saw a short or long pulse width.
If it was long then you saw a zero.
If it is short set a flag, unless the flag is already set in which case you detected a one.
Make sure to reset the flag when you see a zero as well and capture weird pulses as errors, which will help with debug.
You should aim to get at least three to four samples on the short pulse width, more is better, so the sample clock frequency should be above 4 MHz.
Easy to do inside a CPLD or FPGA.
You could also do this on a dedicated timer pin of an MCU, but you would be spending a lot of time in the interrupt routine and might not get much else done.
 

Offline man_marius

  • Contributor
  • Posts: 16
  • Country: be
Re: Differential Bi phase Level Decoder
« Reply #9 on: October 18, 2018, 08:06:42 pm »
Does anybody know how to translate a finite state machine into logic gates,
 

Offline man_marius

  • Contributor
  • Posts: 16
  • Country: be
Re: Differential Bi phase Level Decoder
« Reply #10 on: October 18, 2018, 08:11:10 pm »
thanks @KrudyZ, I will make the design and share it with you guys just for verifications
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 15219
  • Country: nl
    • NCT Developments
Re: Differential Bi phase Level Decoder
« Reply #11 on: October 19, 2018, 03:46:41 am »
What is the signalling rate of the signal?
The easiest way is to sample with 6x (or more) the transmission clock rate and then use a state machine to decode the bits. You can make this auto-align by resetting the statemachine when it detects an illegal combination. IIRC I made an NRZ decoder using two GAL22V10s back in school >20 years ago so a simple CPLD should be able to do it.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline JS

  • Frequent Contributor
  • **
  • Posts: 941
  • Country: ar
Re: Differential Bi phase Level Decoder
« Reply #12 on: October 19, 2018, 06:26:58 pm »
Isn't that differential manchester encoding?

Nobody mentioned it in the thread so you can go to google and get useful results, I bet you can find vhdl code for that!

JS

If I don't know how it works, I prefer not to turn it on.
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 293
Re: Differential Bi phase Level Decoder
« Reply #13 on: October 20, 2018, 01:25:25 am »
http://ww1.microchip.com/downloads/en/appnotes/01470a.pdf

a PIC16F15323  (<$1) has 4 clc's and an nco
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf