好奇怪呀, 我查了下库函数, 还真是是这样的.
/**
* @brief Transmits a Data through the SPIx/I2Sx peripheral.
* @param SPIx: where x can be 1 or 2 in SPI mode to select the SPI peripheral.
* @param Data: Data to be transmitted.
* @retval None
*/
void SPI_SendData8(SPI_TypeDef* SPIx, uint8_t Data)
{
uint32_t spixbase = 0x00;
/* Check the parameters */
assert_param(IS_SPI_ALL_PERIPH(SPIx));
spixbase = (uint32_t)SPIx;
spixbase += 0x0C;
*(__IO uint8_t *) spixbase = Data;
}
/**
* @brief Transmits a Data through the SPIx/I2Sx peripheral.
* @param SPIx: where x can be 1 or 2 in SPI mode or 1 in I2S mode to select
* the SPI peripheral.
* @param Data: Data to be transmitted.
* @retval None
*/
void SPI_I2S_SendData16(SPI_TypeDef* SPIx, uint16_t Data)
{
/* Check the parameters */
assert_param(IS_SPI_ALL_PERIPH(SPIx));
SPIx->DR = (uint16_t)Data;
}
库函数里也有个说明:
The read access of the SPI_DR register can be done using
SPI_ReceiveData8() (when data size is equal or inferior than 8bits) and.
SPI_I2S_ReceiveData16() (when data size is superior than 8bits)function
and returns the Rx buffered value. Whereas a write access to the SPI_DR
can be done using SPI_SendData8() (when data size is equal or inferior than 8bits)
and SPI_I2S_SendData16() (when data size is superior than 8bits) function
and stores the written data into Tx buffer.
看样子只能服从它的规范了. 估计是 SPI 模块里面的数据总线有了什么变化了吧
请路过的朋友也留意一下
|