GEX thesis source code, full text, references
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.3 KiB

\section{1-Wire Unit}
The 1-Wire unit implements the Dallas Semiconductor's 1-Wire protocol, most commonly used to interface smart thermometers (DS18x20). The protocol is explained in \cref{sec:theory_1wire}.
This unit implements the ROM Search algorithm that is used to find the ROM codes of all 1-Wire devices connected to the bus. The algorithm can find up to 32 devices in one run; more devices can be found by issuing the SEARCH\_CONTINUE command.
Devices are addressed using their ROM codes, unique 64-bit (8-byte) identifiers that work as addresses. When only one device is connected, the value 0 may be used instead and the addressing will be skipped. Its ROM code may be recovered using the READ\_ADDR command or by the search algorithm.
\subsection{1-Wire Configuration}
# Data pin
# Parasitic (bus-powered) mode
\subsection{1-Wire Commands}
0 & \cname{CHECK\_PRESENCE}
Test if there are any devices attached to the bus.
& \begin{cmdresp}
\cfield{bool} presence detected
\end{cmdresp} \\
1 & \cname{SEARCH\_ADDR}
Start the search algorithm.
& \begin{cmdresp}
\cfield{bool} should continue
\cfield{u64[]} ROM codes
\end{cmdresp} \\
2 & \cname{SEARCH\_ALARM}
Start the search algorithm, finding only devices in an alarm state.
& \begin{cmdresp}
\cfield{bool} should continue
\cfield{u64[]} ROM codes
\end{cmdresp} \\
3 & \cname{SEARCH\_CONTINUE}
Continue a previously started search
& \begin{cmdresp}
\cfield{bool} should continue
\cfield{u64[]} ROM codes
\end{cmdresp} \\
4 & \cname{READ\_ADDR}
Read a device address (single device only)
& \begin{cmdresp}
\cfield{u64} ROM code
\end{cmdresp} \\
10 & \cname{WRITE}
Write bytes to a device.
& \begin{cmdreq}
\cfield{u64} ROM code
\cfield{u8[]} bytes to write
\end{cmdreq} \\
11 & \cname{READ}
Write a request and read response.
\cfield{u64} ROM code
\cfield{u16} read length
\cfield{bool} verify checksum
\cfield{u8[]} request bytes
\cfield{u8[]} read bytes
20 & \cname{POLL\_FOR\_1}
Wait for a READY status, used by DS18x20.
Not available in parasitic mode.
Responds with SUCCESS after all devices are ready.
& \\