OpenCores
URL https://opencores.org/ocsvn/sd_card_controller/sd_card_controller/trunk

Subversion Repositories sd_card_controller

[/] [sd_card_controller/] [trunk/] [doc/] [src/] [hdl_if.tex] - Diff between revs 8 and 13

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 8 Rev 13
Line 41... Line 41...
%%%%                                                              %%%%
%%%%                                                              %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{HDL interface}
\section{HDL interface}
\label{sec:hdl_if}
\label{sec:hdl_if}
 
 
    IP core has very simple interface:
    This IP core has a very simple interface:
    \begin{figure}[H]
    \begin{figure}[H]
        \centering
        \centering
        \includegraphics[width=11cm]{../bin/ip_core_if.png}
        \includegraphics[width=11cm]{../bin/ip_core_if.png}
        % ip_core.png: 384x469 pixel, 96dpi, 10.16x12.41 cm, bb=
        % ip_core.png: 384x469 pixel, 96dpi, 10.16x12.41 cm, bb=
        \caption{Wishbone SD Card Controller IP Core interface}
        \caption{Wishbone SD Card Controller IP Core interface}
        \label{img:ip_core_if}
        \label{img:ip_core_if}
    \end{figure}
    \end{figure}
    Wishbone slave interface provides access from CPU to all IP core registers (see \ref{sec:regs}). It must
    The Wishbone slave interface provides access from CPU to all IP core registers (see \ref{sec:regs}). It must
    be connected to CPU data master. Wishbone master interface provides access for DMA engine to RAM (see \ref{sec:dma}).
    be connected to a data master. The Wishbone master interface provides access from the DMA engine to RAM (see \ref{sec:dma}).
    It must be connected to RAM memory slave. Interrupts signals provides mechanism to notify the CPU about finished transactions (data and command tranfers).
    It must be connected to a RAM memory slave. Interrupt signals provide a mechanism to notify the CPU about finished transactions (data and command tranfers).
    They are not necesary for proper operation (if You don't want to use interrupts). MMC/SD card interface provides communication with external MMC/SD cards.
    They are not necessary for proper operation, if you don't want to use interrupts. The MMC/SD card interface communicates with external MMC/SD cards.
    It must be connected to external pins of the FPGA wich are connected to MMC/SD card connector. Because those external pins are bidirectional, IP core
    It must be mapped to external pins of the FPGA which are connected to a MMC/SD card connector. Because those external pins are bidirectional, this IP core
    provides inputs, outputs and output enables for these signals.
    provides inputs, outputs and output enables for these signals.
    Table \ref{tab:singals} presents all IP core signals with descriptions.
    Table \ref{tab:signals} presents all the IP core signals with descriptions.
 
 
    \begin{table}
    \begin{table}
    \caption{Signals description}
    \caption{Description of signals}
        \begin{center}
        \begin{center}
            \begin{tabular}{l|l|l|l}
            \begin{tabular}{l|l|l|l}
                    \rowcolor[gray]{0.7} name & direction & width & description \\ \hline \hline
                    \rowcolor[gray]{0.7} name & direction & width & description \\ \hline \hline
                    \multicolumn{4}{c}{Wishbone common signals} \\ \hline
                    \multicolumn{4}{c}{Wishbone common signals} \\ \hline
                    \texttt{wb\_clk\_i} & input & 1 & clock for both master and slave wishbone transactions \\ \hline
                    \texttt{wb\_clk\_i} & input & 1 & clock for both master and slave wishbone transactions \\ \hline
Line 99... Line 99...
                    \multicolumn{4}{c}{Interrupts} \\ \hline
                    \multicolumn{4}{c}{Interrupts} \\ \hline
                    \texttt{int\_cmd} & output & 1 & command transaction finished interrupt \\ \hline
                    \texttt{int\_cmd} & output & 1 & command transaction finished interrupt \\ \hline
                    \texttt{int\_data} & output & 1 & data transaction finished interrupt \\ \hline
                    \texttt{int\_data} & output & 1 & data transaction finished interrupt \\ \hline
                    \hline
                    \hline
            \end{tabular}
            \end{tabular}
            \label{tab:singals}
            \label{tab:signals}
        \end{center}
        \end{center}
    \end{table}
    \end{table}
 
 
    \subsection{Clock consideration}
    \subsection{Clock consideration}
    \label{sec:clock}
    \label{sec:clock}
 
 
    IP core needs two clock sources. First one is for Wishbone bus operation (\texttt{wb\_clk\_i}). There are no constraints for this clock.
    The IP core needs two clock sources. The first is for Wishbone bus operation (\texttt{wb\_clk\_i}). There are no constraints for this clock.
    Second one is for MMC/SD interface operation (\texttt{sd\_clk\_i\_pad}).
    The second is for MMC/SD interface operation (\texttt{sd\_clk\_i\_pad}).
    \texttt{sd\_clk\_i\_pad} is used to drive \texttt{sd\_clk\_o\_pad} output, which is the external MMC/SD card clock source, through internal
    \texttt{sd\_clk\_i\_pad} is used to drive the \texttt{sd\_clk\_o\_pad} output, which is the external MMC/SD card clock source, through an internal
    clock devider. This clock devider is able to devide \texttt{sd\_clk\_i\_pad} clock by 2, 4, 6, 8, ... etc. (2*n where n = [1..256]).
    clock divider. This clock divider is able to divide the \texttt{sd\_clk\_i\_pad} clock by 2, 4, 6, 8, ... etc. (2*n where n = [1..256]).
    \texttt{sd\_clk\_o\_pad} clock frequency depends on MMC/SD specification. To fully utilize the transmission bandwidth \texttt{sd\_clk\_o\_pad}
    The \texttt{sd\_clk\_o\_pad} clock frequency depends on the MMC/SD specification. To fully utilize the transmission bandwidth \texttt{sd\_clk\_o\_pad}
    should be able to perform at 25MHz frequency which imposes constraint of minimum 50MHz on \texttt{sd\_clk\_i\_pad} clock.
    should be able to perform at 25MHz frequency which imposes a minimum constraint of 50MHz on \texttt{sd\_clk\_i\_pad} clock.
    Clock inputs \texttt{wb\_clk\_i} and \texttt{sd\_clk\_i\_pad} can be sourced by the same signal.
    Clock inputs \texttt{wb\_clk\_i} and \texttt{sd\_clk\_i\_pad} can be sourced by the same signal.
 
 
    \subsection{DMA engine}
    \subsection{DMA engine}
    \label{sec:dma}
    \label{sec:dma}
 
 
    DMA engine is used to lower the CPU usage during data transactions\footnote{Data transaction refers to any traffic on the data lines of MMC/SD card interface.}.
    The DMA engine is used to lower the CPU usage during data transactions\footnote{"Data transaction" refers to any traffic on the data lines of MMC/SD card interface.}.
    DMA starts its operation imidiately after succesful end of any read or write command transactions\footnote{Command transaction refers to any traffic on the command line.}
    The DMA engine starts its operation immediately after the successful end of any read or write command transactions\footnote{"Command transaction" refers to any traffic on the command line.}
    \footnote{Read or write command refer to command with data payload such as \textit{block read}(CMD17) or \textit{block write}(CMD24).}.
    \footnote{"Read" or "write" commands refer to commands with data payload such as \textit{block read}(CMD17) or \textit{block write}(CMD24).}.
    During write transactions, data is fetched from RAM automatically, starting from known address. This addres has to be configured by the CPU before sending any write command.
    During write transactions, data is fetched from RAM automatically, starting from a known address. This address has to be configured by the CPU before sending any write commands.
    Similarly, during read transactions, data is written to RAM automatically, starting from known address.
    Similarly, during read transactions, data is written to RAM automatically, starting from a known address.
    This address also has to be configured by the CPU before sending any read command. Because data transmission is half-duplex,
    This address also has to be configured by the CPU before sending any read commands. Because data transmission is half-duplex,
    read and write addresses are placed in the same configuration register. Function of this register depends on the command to be sent.
    read and write addresses are placed in the same configuration register. The function of this register thus depends on the command to be sent.
 
 
    \subsection{Interrupt generation}
    \subsection{Interrupt generation}
    \label{sec:interrupt}
    \label{sec:interrupt}
 
 
    Interrupts are useful when polling technique is not an option. There are two interrupt sources. One to notify the end of the commans transaction (\texttt{int\_cmd} signal) and
    Interrupts are useful when polling is not an option. There are two interrupt sources: One to signify the end of the command transaction (\texttt{int\_cmd} signal) and
    one to notify the end of the data transaction (\texttt{int\_data} signal). Both interrupts has active high logic. All events that triger each interrupts can be masked(see \ref{sec:regs})
    one to signify the end of the data transaction (\texttt{int\_data} signal). Both interrupts use active high logic. All events that trigger an interrupt can be masked. (see \ref{sec:regs})
    and therefore, do not participate in interrupt generation(see \ref{img:events}).
    Events which are masked do not participate in interrupt generation(see Fig. \ref{img:events}).
    \begin{figure}[H]
    \begin{figure}[H]
        \centering
        \centering
        \includegraphics[width=11cm]{../bin/events.png}
        \includegraphics[width=11cm]{../bin/events.png}
        % ip_core.png: 384x469 pixel, 96dpi, 10.16x12.41 cm, bb=
        % ip_core.png: 384x469 pixel, 96dpi, 10.16x12.41 cm, bb=
        \caption{Interrupt generation scheme}
        \caption{Interrupt generation scheme}
Line 142... Line 142...
    \end{figure}
    \end{figure}
 
 
    \subsubsection{Command transaction events}
    \subsubsection{Command transaction events}
    \label{sec:cmd_events}
    \label{sec:cmd_events}
 
 
    Command transaction end interrupt is driven by the command transaction events. The events are:
    The command transaction end interrupt is driven in response to command transaction events. The events are:
    \begin{description}
    \begin{description}
    \item[completion] - transaction completed succesfuly,
    \item[completion] - transaction completed successfully,
    \item[error] - transaction completed with error (one or more of the following events occured),
    \item[error] - transaction completed with error (one or more of the following events occurred),
    \item[timeout] - timeout error (the card did not respond in a timely fashion),
    \item[timeout] - timeout error (the card did not respond in a timely fashion),
    \item[wrong crc] - crc check error (crc calculated from received response data did not match to the crc field of the response),
    \item[wrong CRC] - CRC check error (CRC calculated from received response data did not match to the CRC field of the response),
    \item[wrong index] - index check error (response consists of wrong index field value).
    \item[wrong index] - index check error (response consists of wrong index field value).
    \end{description}
    \end{description}
 
 
    \subsubsection{Data transaction events}
    \subsubsection{Data transaction events}
    \label{sec:data_events}
    \label{sec:data_events}
 
 
    Data transaction end interrupt is driven by the data transaction events. The events are:
    The data transaction end interrupt is driven in response to data transaction events. The events are:
    \begin{description}
    \begin{description}
    \item[completion] - transaction completed succesfuly,
    \item[completion] - transaction completed successfully,
    \item[wrong crc] - crc check error (in case of write transaction, crc received in response to write transaction was different than one calculated by the core;
    \item[wrong CRC] - CRC check error (in case of write transaction, CRC received in response to write transaction was different than the one calculated by the core;
    in case of read transaction, crc calculated from received data did not match to the crc field of received data),
    in case of read transaction, the CRC calculated from received data did not match to the CRC field of the received data),
    \item[fifo error] - internal fifo error (in case of write transaction, tx fifo became empty before all data was send; in case of read transaction, rx fifo became
    \item[FIFO error] - internal FIFO error (in case of write transaction, tx FIFO became empty before all data was sent; in case of read transaction, rx FIFO became
    full; both cases are caused by to slow wishbone bus or wishbone bus been busy for to long)).
    full; both cases are caused by too slow of a wishbone bus or the wishbone bus being busy for too long)).
    \end{description}
    \end{description}
 
 
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.