I'm referring to line codes like bipolar, machester, miller etc... https://en.m.wikipedia.org/wiki/Line_code

How do these line codes relate to bus protocols?

Is it another level down? Is it hardwired into the metal like with Ethernet? Are they used for completely different purposes like how we have CDMA for phonecalls but ADSL for Internet?

Or could we customize a SPI interface to generate any number of line codes based on combinations of polarity and alpha (i.e. high/low on rising/falling edge)

  • \$\begingroup\$ This is far too broad to be answerable; with no generalization really possible you're basically asking for an individual review of everything you list, which is well beyond the bounds of a reasonable question on a stack exchange site. \$\endgroup\$ – Chris Stratton Jun 13 '19 at 5:35
  • \$\begingroup\$ I realise that but I'm not asking for a masters thesis. Just a nudge in the right direction. \$\endgroup\$ – BitShift Jun 13 '19 at 5:37
  • \$\begingroup\$ Spend some time doing your own research about how each standard of interest that you list works. Your posted question is neither meaningful nor answerable. Stack exchange sites are reserved only for those questions which can be specifically and concisely answered; there is an entire rest of the internet to research what does not fit this intentionally narrow mission. \$\endgroup\$ – Chris Stratton Jun 13 '19 at 5:39
  • \$\begingroup\$ Ok well thanks for that very usefull answer. I hadn't thought to read the information but now that you mention it, I guess I'll just re-read the weeks worth of info I've just scoured through. Next time you tell someone to 'read the manual' maybe consider whether or not you're being helpful. \$\endgroup\$ – BitShift Jun 13 '19 at 5:41
  • \$\begingroup\$ If you'd actually read anything about how SPI (to pick one example) works, you'd realize that your question/proposal about it makes no sense. \$\endgroup\$ – Chris Stratton Jun 13 '19 at 5:42

At the highest level, all buses transport a series of 0s and 1s.

Buses that are designed to be used on a single board (SPI, I²C, UART) use the simplest line code, NRZ-L, where 0/1 = low/high voltage. Theses buses have a separate clock line, or assume that all devices use a common clock.

Buses that are designed to be used over longer distances use other line codes, mainly to encode the clock and data into a single line, and to increase robustness against noise.

The purpose of all these buses is interoperability, so they must define the protocol and the electrical properties; otherwise, devices would not work with each other. Customization would be possible only if some mechanism to describe the customization were included in the protocol itself.

| improve this answer | |
  • \$\begingroup\$ This is the answer I was looking for. Thank you. \$\endgroup\$ – BitShift Jun 13 '19 at 11:24

Line coding is required if the clock is not or cannot be transmitted separately with the data --- so the data is encoded in such a way that a clock can be recovered or can be synchronized with the data. Typical applications are over long distances such as transmission lines.

This is very different from SPI and I2C etc since a clock is transmitted separately from the data, it is pointless as clock recovery is not required. It would also be be far too complex to encode SPI/I2C etc and the protocol standards forbid that. Typical applications are over short distances such as PCB to sensor communications.

1-wire communication bus is possibly the closest bus as it does not provide clock however timings are very specific, controlled by master-slave, and its own protocol provides toggling bits to indicate each bit. It does not require the recovery of a clock in the same way as line encoding to decode successfully.

| improve this answer | |

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