⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 at91rm9200_spi.html

📁 AT91RM9200的USB相关ACM CDC的源代码包! AT91RM9200-BasicUSBPipe-ARM1_2-2_0.zip
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_PutChar">AT91F_SPI_PutChar</a></b></font></td><td><font size="-1">Send a character,does not check if ready to send</font></td></tr>
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_DisableIt">AT91F_SPI_DisableIt</a></b></font></td><td><font size="-1">Disable SPI interrupt</font></td></tr>
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_GetInterruptMaskStatus">AT91F_SPI_GetInterruptMaskStatus</a></b></font></td><td><font size="-1">Return SPI Interrupt Mask Status</font></td></tr>
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_IsInterruptMasked">AT91F_SPI_IsInterruptMasked</a></b></font></td><td><font size="-1">Test if SPI Interrupt is Masked </font></td></tr>
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_ReceiveFrame">AT91F_SPI_ReceiveFrame</a></b></font></td><td><font size="-1">Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy</font></td></tr>
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_Open">AT91F_SPI_Open</a></b></font></td><td><font size="-1">Open a SPI Port</font></td></tr>
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_CfgCs">AT91F_SPI_CfgCs</a></b></font></td><td><font size="-1">Configure SPI chip select register</font></td></tr>
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_EnableIt">AT91F_SPI_EnableIt</a></b></font></td><td><font size="-1">Enable SPI interrupt</font></td></tr>
<tr><td bgcolor="#FFFFCC"><font size="-1"><b><a href="lib_AT91RM9200_h.html#AT91F_SPI_CfgPCS">AT91F_SPI_CfgPCS</a></b></font></td><td><font size="-1">Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected</font></td></tr>
</null></table></null><h2>SPI Register Description</h2>
<null><a name="SPI_CR"></a><h4><a href="#SPI">SPI</a>: <i><a href="AT91RM9200_h.html#AT91_REG">AT91_REG</a></i> SPI_CR  <i>Control Register</i></h4><ul><null><font size="-2"><li><b>SPI</b> <i><a href="AT91RM9200_h.html#AT91C_SPI_CR">AT91C_SPI_CR</a></i> 0xFFFE0000</font></null></ul><table border=1 cellpadding=0 cellspacing=0 width="100%"><null><th bgcolor="#FFFFCC"><b>Offset</b></th><th bgcolor="#FFFFCC"><b>Name</b></th><th bgcolor="#FFFFCC"><b>Description</b></th><tr><td align="CENTER" bgcolor="#FFFFCC">0</td><td align="CENTER"><a name="SPI_SPIEN"></a><b>SPI_SPIEN</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_SPIEN">AT91C_SPI_SPIEN</a></font></td><td><b>SPI Enable</b><br>0 = No effect.<br>1 = Enables the SPI to transfer and receive data.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">1</td><td align="CENTER"><a name="SPI_SPIDIS"></a><b>SPI_SPIDIS</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_SPIDIS">AT91C_SPI_SPIDIS</a></font></td><td><b>SPI Disable</b><br>0 = No effect.<br>1 = Disables the SPI.<br>All pins are set in input mode and no data is received or transmitted.<br>If a transfer is in progress, the transfer is finished before the SPI is disabled.<br>If both SPIEN and SPIDIS are equal to one when the control register is written, the SPI is disabled.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">7</td><td align="CENTER"><a name="SPI_SWRST"></a><b>SPI_SWRST</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_SWRST">AT91C_SPI_SWRST</a></font></td><td><b>SPI Software reset</b><br>0 = No effect.<br>1 = Resets the SPI.<br>A software triggered hardware reset of the SPI interface is performed.</td></tr>
</null></table>
<a name="SPI_MR"></a><h4><a href="#SPI">SPI</a>: <i><a href="AT91RM9200_h.html#AT91_REG">AT91_REG</a></i> SPI_MR  <i>Mode Register</i></h4><ul><null><font size="-2"><li><b>SPI</b> <i><a href="AT91RM9200_h.html#AT91C_SPI_MR">AT91C_SPI_MR</a></i> 0xFFFE0004</font></null></ul><table border=1 cellpadding=0 cellspacing=0 width="100%"><null><th bgcolor="#FFFFCC"><b>Offset</b></th><th bgcolor="#FFFFCC"><b>Name</b></th><th bgcolor="#FFFFCC"><b>Description</b></th><tr><td align="CENTER" bgcolor="#FFFFCC">0</td><td align="CENTER"><a name="SPI_MSTR"></a><b>SPI_MSTR</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_MSTR">AT91C_SPI_MSTR</a></font></td><td><b>Master/Slave Mode</b><br>0 = SPI is in Slave mode.<br>1 = SPI is in Master mode.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">1</td><td align="CENTER"><a name="SPI_PS"></a><b>SPI_PS</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_PS">AT91C_SPI_PS</a></font></td><td><b>Peripheral Select</b><font size="-1"><table bgcolor="#E3F2FF" border=1 cellpadding=0 cellspacing=0 width="100%"><null><th><b>Value</b></th><th><b>Label</b></th><th><b>Description</b></th><tr><td align="CENTER">0</td><td align="CENTER"><a name="SPI_PS_FIXED"></a><b>SPI_PS_FIXED</b><font size="-1"><br><a href="AT91RM9200_h.html#AT91C_SPI_PS_FIXED">AT91C_SPI_PS_FIXED</a></font></td><td><br>Fixed Peripheral Select</td></tr>
<tr><td align="CENTER">1</td><td align="CENTER"><a name="SPI_PS_VARIABLE"></a><b>SPI_PS_VARIABLE</b><font size="-1"><br><a href="AT91RM9200_h.html#AT91C_SPI_PS_VARIABLE">AT91C_SPI_PS_VARIABLE</a></font></td><td><br>Variable Peripheral Select</td></tr>
</null></table></font>
</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">2</td><td align="CENTER"><a name="SPI_PCSDEC"></a><b>SPI_PCSDEC</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_PCSDEC">AT91C_SPI_PCSDEC</a></font></td><td><b>Chip Select Decode</b><br>0 = The chip selects are directly connected to a peripheral device.<br>1 = The four chip select lines are connected to a 4- to 16-bit decoder.<br>When PCSDEC equals one, up to 16 Chip Select signals can be generated with the four lines using an external 4- to 16- bit decoder.<br>The Chip Select Registers define the characteristics of the 16 chip selects according to the following rules:<br>	SPI_CSR0 defines peripheral chip select signals 0 to 3.<br>	SPI_CSR1 defines peripheral chip select signals 4 to 7.<br>	SPI_CSR2 defines peripheral chip select signals 8 to 11.<br>	SPI_CSR3 defines peripheral chip select signals 12 to 15 (1) .<br>Note: 1. The 16th state corresponds to a state in which all chip selects are inactive. This allows a different clock configuration to be defined by each chip select register.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">3</td><td align="CENTER"><a name="SPI_DIV32"></a><b>SPI_DIV32</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_DIV32">AT91C_SPI_DIV32</a></font></td><td><b>Clock Selection</b><br>0 = SPI Master Clock equals MCK<br>1 = SPI Master Clock equals MCK/32</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">4</td><td align="CENTER"><a name="SPI_MODFDIS"></a><b>SPI_MODFDIS</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_MODFDIS">AT91C_SPI_MODFDIS</a></font></td><td><b>Mode Fault Detection</b><br>0 = Mode Fault Detection is enabled<br>1 = Mode Fault Detection is disabled</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">7</td><td align="CENTER"><a name="SPI_LLB"></a><b>SPI_LLB</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_LLB">AT91C_SPI_LLB</a></font></td><td><b>Clock Selection</b><br>0 = Local loopback path disabled<br>1 = Local loopback path enabled<br>LLB controls the local loopback on the data serializer for testing in master mode only.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">19..16</td><td align="CENTER"><a name="SPI_PCS"></a><b>SPI_PCS</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_PCS">AT91C_SPI_PCS</a></font></td><td><b>Peripheral Chip Select</b><br>This field is only used if Fixed Peripheral Select is active (PS = 0).<br>	If PCSDEC=0:<br>		PCS = xxx0 NPCS[3:0] = 1110<br>		PCS = xx01 NPCS[3:0] = 1101<br>		PCS = x011 NPCS[3:0] = 1011<br>		PCS = 0111 NPCS[3:0] = 0111<br>		PCS = 1111 forbidden (no peripheral is selected)<br>		(x = don&#146;t care)<br>	If PCSDEC=1: NPCS[3:0] output signals = PCS</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">31..24</td><td align="CENTER"><a name="SPI_DLYBCS"></a><b>SPI_DLYBCS</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_DLYBCS">AT91C_SPI_DLYBCS</a></font></td><td><b>Delay Between Chip Selects</b><br>This field defines the delay from NPCS inactive to the activation of another NPCS. The DLYBCS time guarantees non-overlapping chip selects and solves bus contentions in case of peripherals having long data float times.<br>If DLYBCS is less than or equal to six, six SPI Master Clock periods will be inserted by default.<br>Otherwise, the following equation determines the delay:<br>	Delay_ Between_Chip_Selects = DLYBCS * SPI_Master_Clock_period</td></tr>
</null></table>
<a name="SPI_RDR"></a><h4><a href="#SPI">SPI</a>: <i><a href="AT91RM9200_h.html#AT91_REG">AT91_REG</a></i> SPI_RDR  <i>Receive Data Register</i></h4><ul><null><font size="-2"><li><b>SPI</b> <i><a href="AT91RM9200_h.html#AT91C_SPI_RDR">AT91C_SPI_RDR</a></i> 0xFFFE0008</font></null></ul><table border=1 cellpadding=0 cellspacing=0 width="100%"><null><th bgcolor="#FFFFCC"><b>Offset</b></th><th bgcolor="#FFFFCC"><b>Name</b></th><th bgcolor="#FFFFCC"><b>Description</b></th><tr><td align="CENTER" bgcolor="#FFFFCC">15..0</td><td align="CENTER"><a name="SPI_RD"></a><b>SPI_RD</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_RD">AT91C_SPI_RD</a></font></td><td><b>Receive Data</b><br>Data received by the SPI Interface is stored in this register right-justified. Unused bits read zero.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">19..16</td><td align="CENTER"><a name="SPI_RPCS"></a><b>SPI_RPCS</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_RPCS">AT91C_SPI_RPCS</a></font></td><td><b>Peripheral Chip Select Status</b><br>In Master Mode only, these bits indicate the value on the NPCS pins at the end of a transfer. Otherwise, these bits read zero.</td></tr>
</null></table>
<a name="SPI_TDR"></a><h4><a href="#SPI">SPI</a>: <i><a href="AT91RM9200_h.html#AT91_REG">AT91_REG</a></i> SPI_TDR  <i>Transmit Data Register</i></h4><ul><null><font size="-2"><li><b>SPI</b> <i><a href="AT91RM9200_h.html#AT91C_SPI_TDR">AT91C_SPI_TDR</a></i> 0xFFFE000C</font></null></ul><table border=1 cellpadding=0 cellspacing=0 width="100%"><null><th bgcolor="#FFFFCC"><b>Offset</b></th><th bgcolor="#FFFFCC"><b>Name</b></th><th bgcolor="#FFFFCC"><b>Description</b></th><tr><td align="CENTER" bgcolor="#FFFFCC">15..0</td><td align="CENTER"><a name="SPI_TD"></a><b>SPI_TD</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_TD">AT91C_SPI_TD</a></font></td><td><b>Transmit Data</b><br>Data which is to be transmitted by the SPI Interface is stored in this register. Information to be transmitted must be writ-ten to the transmit data register in a right-justified format.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">19..16</td><td align="CENTER"><a name="SPI_TPCS"></a><b>SPI_TPCS</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_TPCS">AT91C_SPI_TPCS</a></font></td><td><b>Peripheral Chip Select Status</b><br>This field is only used if Variable Peripheral Select is active (PS = 1) and if the SPI is in Master Mode.<br>	If PCSDEC = 0:<br>		PCS = xxx0 NPCS[3:0] = 1110<br>		PCS = xx01 NPCS[3:0] = 1101<br>		PCS = x011 NPCS[3:0] = 1011<br>		PCS = 0111 NPCS[3:0] = 0111<br>		PCS = 1111 forbidden (no peripheral is selected)<br>		(x = don&#146;t care)<br>	If PCSDEC = 1:<br>		NPCS[3:0] output signals = PCS</td></tr>
</null></table>
<a name="SPI_SR"></a><h4><a href="#SPI">SPI</a>: <i><a href="AT91RM9200_h.html#AT91_REG">AT91_REG</a></i> SPI_SR  <i>Status Register</i></h4><ul><null><font size="-2"><li><b>SPI</b> <i><a href="AT91RM9200_h.html#AT91C_SPI_SR">AT91C_SPI_SR</a></i> 0xFFFE0010</font></null></ul><table border=1 cellpadding=0 cellspacing=0 width="100%"><null><th bgcolor="#FFFFCC"><b>Offset</b></th><th bgcolor="#FFFFCC"><b>Name</b></th><th bgcolor="#FFFFCC"><b>Description</b></th><tr><td align="CENTER" bgcolor="#FFFFCC">0</td><td align="CENTER"><a name="SPI_RDRF"></a><b>SPI_RDRF</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_RDRF">AT91C_SPI_RDRF</a></font></td><td><b>Receive Data Register Full</b><br>0 = No data has been received since the last read of SPI_RDR<br>1= Data has been received and the received data has been transferred from the serializer to SPI_RDR since the lastread of SPI_RDR.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">1</td><td align="CENTER"><a name="SPI_TDRE"></a><b>SPI_TDRE</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_TDRE">AT91C_SPI_TDRE</a></font></td><td><b>Transmit Data Register Empty</b><br>0 = Data has been written to SPI_TDR and not yet transferred to the serializer.<br>1 = The last data written in the Transmit Data Register has been transferred in the serializer.<br>TDRE equals zero when the SPI is disabled or at reset. The SPI enable command sets this bit to one.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">2</td><td align="CENTER"><a name="SPI_MODF"></a><b>SPI_MODF</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_MODF">AT91C_SPI_MODF</a></font></td><td><b>Mode Fault Error</b><br>0 = No Mode Fault has been detected since the last read of SPI_SR.<br>1 = A Mode Fault occurred since the last read of the SPI_SR.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">3</td><td align="CENTER"><a name="SPI_OVRES"></a><b>SPI_OVRES</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_OVRES">AT91C_SPI_OVRES</a></font></td><td><b>Overrun Error Status</b><br>0 = No overrun has been detected since the last read of SPI_SR.<br>1 = An overrun has occurred since the last read of SPI_SR.<br>An overrun occurs when SPI_RDR is loaded at least twice from the serializer since the last read of the SPI_RDR.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">4</td><td align="CENTER"><a name="SPI_SPENDRX"></a><b>SPI_SPENDRX</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_SPENDRX">AT91C_SPI_SPENDRX</a></font></td><td><b>End of Receiver Transfer</b><br>0 = The End of Transfer signal from the Peripheral Data Controller channel dedicated to the receiver is inactive.<br>1 = The End of Transfer signal from the Peripheral Data Controller channel dedicated to the receiver is active.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">5</td><td align="CENTER"><a name="SPI_SPENDTX"></a><b>SPI_SPENDTX</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_SPENDTX">AT91C_SPI_SPENDTX</a></font></td><td><b>End of Receiver Transfer</b><br>0 = The End of Transfer signal from the Peripheral Data Controller channel dedicated to the transmitter is inactive.<br>1 = The End of Transfer signal from the Peripheral Data Controller channel dedicated to the transmitter is active.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">6</td><td align="CENTER"><a name="SPI_RXBUFF"></a><b>SPI_RXBUFF</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_RXBUFF">AT91C_SPI_RXBUFF</a></font></td><td><b>RXBUFF Interrupt</b><br>0 = PDC2 Reception Buffer is not full.<br>1 = PDC2 Reception Buffer is full.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">7</td><td align="CENTER"><a name="SPI_TXBUFE"></a><b>SPI_TXBUFE</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_TXBUFE">AT91C_SPI_TXBUFE</a></font></td><td><b>TXBUFE Interrupt</b><br>0 = PDC2 Transmission Buffer is not empty.<br>1 = PDC2 Transmission Buffer is empty</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">16</td><td align="CENTER"><a name="SPI_SPIENS"></a><b>SPI_SPIENS</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_SPIENS">AT91C_SPI_SPIENS</a></font></td><td><b>Enable Status</b><br>0 = SPI is disabled.<br>1 = SPI is enabled.</td></tr>
</null></table>
<a name="SPI_IER"></a><h4><a href="#SPI">SPI</a>: <i><a href="AT91RM9200_h.html#AT91_REG">AT91_REG</a></i> SPI_IER  <i>Interrupt Enable Register</i></h4><ul><null><font size="-2"><li><b>SPI</b> <i><a href="AT91RM9200_h.html#AT91C_SPI_IER">AT91C_SPI_IER</a></i> 0xFFFE0014</font></null></ul><table border=1 cellpadding=0 cellspacing=0 width="100%"><null><th bgcolor="#FFFFCC"><b>Offset</b></th><th bgcolor="#FFFFCC"><b>Name</b></th><th bgcolor="#FFFFCC"><b>Description</b></th><tr><td align="CENTER" bgcolor="#FFFFCC">0</td><td align="CENTER"><a name="SPI_RDRF"></a><b>SPI_RDRF</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_RDRF">AT91C_SPI_RDRF</a></font></td><td><b>Receive Data Register Full</b><br>0 = No data has been received since the last read of SPI_RDR<br>1= Data has been received and the received data has been transferred from the serializer to SPI_RDR since the lastread of SPI_RDR.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">1</td><td align="CENTER"><a name="SPI_TDRE"></a><b>SPI_TDRE</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_TDRE">AT91C_SPI_TDRE</a></font></td><td><b>Transmit Data Register Empty</b><br>0 = Data has been written to SPI_TDR and not yet transferred to the serializer.<br>1 = The last data written in the Transmit Data Register has been transferred in the serializer.<br>TDRE equals zero when the SPI is disabled or at reset. The SPI enable command sets this bit to one.</td></tr>
<tr><td align="CENTER" bgcolor="#FFFFCC">2</td><td align="CENTER"><a name="SPI_MODF"></a><b>SPI_MODF</b><font size="-2"><br><a href="AT91RM9200_h.html#AT91C_SPI_MODF">AT91C_SPI_MODF</a></font></td><td><b>Mode Fault Error</b><br>0 = No Mode Fault has been detected since the last read of SPI_SR.<br>1 = A Mode Fault occurred since the last read of the SPI_SR.</td></tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -