22.3.2 Transport Protocol
The transport level protocol follows a simple model, in part based on treating most 1-wire devices as memory like (IDs, ROM, EEPROM, etc) even if some are sensors or actuators. All commands and data are in 8-bit (byte) quantities and the post-reset commands are pre-defined. The basic protocol is:
- Reset the line by driving and holding the OWIRE signal low for > 480 µs.
- Wait for answer-to-reset from one or more slaves. Answer-to-reset (ATR) is defined as each slave pulling the line low for 60 µs to 240 µs. If the line does not go low, there is no slave on the bus. If it does, there is one or more.
- At this point the Master either figures out the ID of the slaves on the bus using the enumeration scheme, or selects a slave to issue a command. The select command to use is based on whether there is one slave or more than one. If there is only one slave device, the Master skips the selection process. If more than one are present, the Master selects a slave by sending out the ID for the selected slave, indicating to the remaining slaves that any further commands should be ignored until after the next reset.
- The Master sends a command followed by a sending or receiving of data. While most commands are implemented using bytes read or written, some commands use bytes where some bits are written and some read. Since a read looks like a write 1, if the line is held and driven low for less than 15 μs and the slave does not know it is supposed to reply, the line remains untouched and is read as a 1 (and written as a 1).
- Usually at the end of one or more commands to that slave, a reset is issued again.
The 1-Wire module supports reset and answer-to-reset on request (although answer-to-reset can be suppressed). It also supports byte operations. The software chooses which read, write, or mixed operation to use. Partial byte (bit or multi-bit) is also supported.