Line 51... |
Line 51... |
\usepackage{import}
|
\usepackage{import}
|
\usepackage{bytefield}
|
\usepackage{bytefield}
|
\project{SDSPI Controller}
|
\project{SDSPI Controller}
|
\title{Specification}
|
\title{Specification}
|
\author{Dan Gisselquist, Ph.D.}
|
\author{Dan Gisselquist, Ph.D.}
|
\email{dgisselq (at) opencores.org}
|
\email{dgisselq (at) ieee.org}
|
\revision{Rev.~0.1}
|
\revision{Rev.~0.1}
|
\begin{document}
|
\begin{document}
|
\pagestyle{gqtekspecplain}
|
\pagestyle{gqtekspecplain}
|
\titlepage
|
\titlepage
|
\begin{license}
|
\begin{license}
|
Line 333... |
Line 333... |
The first step in any start up sequence is to clear the card from any
|
The first step in any start up sequence is to clear the card from any
|
prior condition. Hence we wait for the card to be no longer busy (it
|
prior condition. Hence we wait for the card to be no longer busy (it
|
shouldn't be busy anyway), and we then clear any errors:
|
shouldn't be busy anyway), and we then clear any errors:
|
\begin{tabbing}
|
\begin{tabbing}
|
{\tt SD\_WAIT\_WHILE\_BUSY;} \\
|
{\tt SD\_WAIT\_WHILE\_BUSY;} \\
|
{\tt CMD} \= {\tt SD\_CLEARERR};
|
{\tt CMD} \= {\tt = SD\_CLEARERR};
|
\end{tabbing}
|
\end{tabbing}
|
|
|
Now that the controller is idle (which it should've been from startup anyway),
|
Now that the controller is idle (which it should've been from startup anyway),
|
we can now set up our interface. For this, we'll set our clock rate to 400~KHz.
|
we can now set up our interface. For this, we'll set our clock rate to 400~KHz.
|
The clock division register, sometimes erroneously called the speed, is found
|
The clock division register, sometimes erroneously called the speed, is found
|
Line 456... |
Line 456... |
command to complete. Further, since this command is going to read from our
|
command to complete. Further, since this command is going to read from our
|
FIFO, we need to include the {\tt SD\_FIFO\_OP} part of the command:
|
FIFO, we need to include the {\tt SD\_FIFO\_OP} part of the command:
|
\begin{tabbing}
|
\begin{tabbing}
|
{\tt int CSD[4];}\\
|
{\tt int CSD[4];}\\
|
{\tt DATA} \= {\tt = 0;} \\
|
{\tt DATA} \= {\tt = 0;} \\
|
{\tt CMD} \> {\tt = (SD\_FIFO\_OP|SD\_CMD)+9;}
|
{\tt CMD} \> {\tt = (SD\_FIFO\_OP|SD\_CMD)+9;} \\
|
{\tt SD\_WAIT\_WHILE\_BUSY;} \\
|
{\tt SD\_WAIT\_WHILE\_BUSY;} \\
|
{\tt for(int i=0; i<4; i++) } \\
|
{\tt for(int i=0; i<4; i++) } \\
|
\> {\tt CSD[i] = FIFO[0];}
|
\> {\tt CSD[i] = FIFO[0];}
|
\end{tabbing}
|
\end{tabbing}
|
Once the command is complete, we can read the four 32--bit words of the CSD
|
Once the command is complete, we can read the four 32--bit words of the CSD
|