Communication Protocols · Interview question

How are 1-Wire devices addressed, and how do you find them all on a bus?

A strong answer

Every 1-Wire device is laid down at the factory with a unique 64-bit ROM code, structured as an 8-bit family code (what kind of device), a 48-bit serial number, and an 8-bit CRC over the rest. To talk to a specific device the master issues a MATCH ROM command followed by that device's 64-bit code, so only the matching device responds; if there's exactly one device on the bus you can shortcut with SKIP ROM and skip addressing entirely. To discover unknown devices, the master runs the ROM search algorithm: it's a binary-tree walk over the 64 ID bits where, at each bit position, all participating devices simultaneously report the bit and its complement, and when devices disagree (a discrepancy, meaning some have 0 and some have 1 at that position) the master chooses a branch and records the discrepancy so it can take the other branch on a subsequent pass, repeating until it has enumerated every device's full 64-bit ID. This lets you hang many sensors on a single wire and reliably find and address each one, validating each ROM code's CRC as you go. So addressing is by globally-unique 64-bit ID, and enumeration is the systematic search that exploits the open-drain wired-AND to resolve the IDs bit by bit.

What a weak answer sounds like

You know the answer. Do you know what gets you dinged?

Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.

From the lesson

Modbus & 1-Wire

Two field protocols beyond the big three: Modbus (industrial register access over RS-485/TCP, master/slave with CRC) and 1-Wire (a single line carrying power and data to addressable sensors).

More Modbus & 1-Wire questions

Browse all 472 interview questions
How are 1-Wire devices addressed, and how do you find them all on a bus? | EmbeddedPrep.io