1
\$\begingroup\$

This video describes a decoder circuit for Manchester encoded signals, and the same circuit is also mentioned in this article. I can understand the circuit, and I'm interested in what different approaches exist for creating the delay in the delay circuit (should delay the clock to D flip flop by 1/4th period, since that always samples the correct non-return-to-zero value. ) I also note that the NRZ is shifted 1/4th of a period, but the XOR to recover the clock rate still works, the rising edge is still synchronized, it just has occasional clock pulses with a different duty cycle. The delay circuit delays the clock by 3/4ths of a period (to sample 1/4th period too early. ) How is that achieved, usually?

enter image description here

I've simulated the circuit in VHDL, with a delay circuit that already knows the clock rate, and then it works. But that is kind of meaningless because the point of Manchester is to recover the clock without knowing it. I was curious to if there are solutions where the clock is delayed 3/4ths of a clock signal using only the clock signal in the Manchester encoded signal. Or as close to that as possible. And if such solutions can adapt dynamically to different frequencies.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity decoder is
    Port ( clk    : in STD_LOGIC;
           mcr_enc: in STD_LOGIC;
           clk_rec: out STD_LOGIC;
           NRZ_rec: out STD_LOGIC
           );
end decoder;

architecture Behavioral of decoder is

signal NRZ : STD_LOGIC := '0';
signal REC_CLK : STD_LOGIC := '0';
signal clk_rec_buf: STD_LOGIC_VECTOR (7 downto 0)  := "11101111";

begin
    NRZ_rec <= NRZ;
    clk_rec <= REC_CLK;
    REC_CLK <= mcr_enc XOR NRZ;
    process (clk)
    begin
        if rising_edge (clk) then
            if clk_rec_buf(5) = '0' and clk_rec_buf(4) = '1' then
                NRZ <= mcr_enc;
            end if;
            clk_rec_buf <= clk_rec_buf(6 downto 0)&REC_CLK;
        end if;
    end process;
end Behavioral;

This is a pretty broad question. I'm very interested, if anyone is interested in explaining the answer to me and understands what I ask and why.

\$\endgroup\$
13
  • 2
    \$\begingroup\$ "The point of Manchester is to recover the clock without knowing it" is not precisely correct. Manchester decoders assume that the clock rate is known by the receiver. It allows clock and data to be transmitted over a single pair. A good discussion is at renesas.com/us/en/document/dst/hd-15530-datasheet?r=496341 . \$\endgroup\$ Commented Mar 15, 2023 at 22:58
  • 1
    \$\begingroup\$ For another take on Manchester encoding, look up Mil Std 1553, which uses Manchester encoding. While this is a old standard going back almost 50 years, it is still being used on new high tech programs, including the James Webb Space Telescope. \$\endgroup\$
    – SteveSh
    Commented Mar 16, 2023 at 0:22
  • \$\begingroup\$ The point is, the delay doesn't have to be all that precise. Anything between, say, 60% and 90% of the bit period will work just fine, with somewhat reduced tolerance of jitter on the input signal. Put another way, with a fixed delay, you can decode a range of bit periods that's +/-20% of your nominal value. \$\endgroup\$
    – Dave Tweed
    Commented Mar 16, 2023 at 2:12
  • \$\begingroup\$ SteveSh, John, Dave, thanks, all good comments, will look into what you all said later today \$\endgroup\$
    – BipedalJoe
    Commented Mar 16, 2023 at 12:25
  • \$\begingroup\$ @DaveTweed very good point and maybe that de-mystifies it all enough for me. Of course sampling anywhere within half a clock cycle early works (but with less margins for jitter), did not think about that. Have tested in my VHDL simulation too with 1/8th too early, and 3/8ths, and works great. Cool stuff. I'd still like to understand the type of circuit often used for creating the delay. Perhaps John or Steve's comment addresses that, will have a look at what they mention later today. \$\endgroup\$
    – BipedalJoe
    Commented Mar 16, 2023 at 15:05

1 Answer 1

1
\$\begingroup\$

If you are using an FPGA, then there are a few ways to create a delay.

  1. Shift register delay: If you have a clock source "clk" that is 8X the frequency of the expected frequency of "clk_rec" then you can just sample the incoming signal "mcr_enc" into six flip flops to create the delay.

  2. Use a DCM tile: In Xilinx 7 series parts there are DCM tiles that can generate a clock using a PLL. The multiply and divide ratios and phase are configurable at runtime. It's possible to make logic to adjust the DCM output clock frequency to, on average, match the incoming transition rate.

    Furthermore, the clock feedback input to the DCM can come from an external pin. So, one should in theory be able to make the PLL directly track the Manchester encoded bit rate (so long as the bit rate falls within the allowed frequency range for the PLL).

\$\endgroup\$
3
  • \$\begingroup\$ not in an FPGA, just generally. I only included the VHDL code to show that I’d at least tested to simulate the circult, sometimes forums like this want you to show what effort you made yourself to discover the answer on your own \$\endgroup\$
    – BipedalJoe
    Commented Mar 16, 2023 at 12:23
  • \$\begingroup\$ Well even without using an FPGA, the approach of using a VCO and phase detector to make a PLL is valid. \$\endgroup\$
    – user4574
    Commented Mar 16, 2023 at 14:34
  • \$\begingroup\$ Thanks, I'll look into phase locked loop. \$\endgroup\$
    – BipedalJoe
    Commented Mar 16, 2023 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.