GEX thesis source code, full text, references
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
gex-thesis/ch.unit.1wire.tex

85 lignes
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}
\begin{inicode}
[1WIRE:ow@7]
# Data pin
pin=A0
# Parasitic (bus-powered) mode
parasitic=N
\end{inicode}
\subsection{1-Wire Commands}
\begin{cmdlist}
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.
&
\begin{cmdreq}
\cfield{u64} ROM code
\cfield{u16} read length
\cfield{bool} verify checksum
\cfield{u8[]} request bytes
\end{cmdreq}
\cjoin
\begin{cmdresp}
\cfield{u8[]} read bytes
\end{cmdresp}
\\
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.
& \\
\end{cmdlist}