5
\$\begingroup\$

What's an efficient algorithm for recovering the clock and decoding Manchester-encoded data?

\$\endgroup\$
  • \$\begingroup\$ By any chance are you trying to Decode UNI/O protocol? \$\endgroup\$ – jsolarski Mar 10 '11 at 0:15
  • \$\begingroup\$ No protocol, just self-clocked serial data. \$\endgroup\$ – joeforker Mar 10 '11 at 1:52
  • \$\begingroup\$ just as a reference, Microchips UNI/O does Manchester-encoding, the application notes will give some great info and sample c code, microchip.com/stellent/… I know you are not using a protocol but it will give you a good start on how to decode your signal \$\endgroup\$ – jsolarski Mar 10 '11 at 3:03
3
\$\begingroup\$

That depends what you have to work with. If you're oversampling at a rate of at least 4.1x the bit rate (2.05x the max transition frequency), a simple approach is to use a state machine in which the duration of each high/low time is compared to either 1.5x the previous duration (if the previous one is thought to be 'short') or 0.75x the previous duration (if thought to be 'long'). Note that if you don't know whether you're starting with long or short pulses, you may misidentify a continuous sequence of long pulses as short, or vice versa, but the first pulse of the "other" width will be correctly recognized.

To clarify: suppose the goal is to recognize non-differential manchester-coded data encoded per IEEE 802.3. If one gets a transition after a "long" time, the state of the communications line following the transition will represent a bit of data. If one gets a transition after a "short" time, ignore it but look at the next one (which is expected to be short); the state of the line after that next transition will represent a bit of data.

For differential coding, a "long" state time represents a zero; two "short" state times represent a 1 (if a short is followed by a long, there's a communications error).

\$\endgroup\$
  • \$\begingroup\$ Are you sure you are talking about the same thing? A 'long' pulse in Manchester code would mean it's switching from 1's to 0's or vice-versa? \$\endgroup\$ – joeforker Mar 9 '11 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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