关于原子哥SPI程序的问题,小白不懂!!!!

2019-07-20 18:41发布

我下载了原子哥的探索者程序源码,在用SPI程序的时候发现了一个问题,不是很懂!!
程序里面的SPIWriteRead是8位读写,

然后进入SPI Send和SPI Recevie却是16位!不是很懂!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
4条回答
xkwy
2019-07-21 02:37
SHU 发表于 2016-11-23 16:04
意思是,只要在SPI初始化里面设置为8位,即使读写是16位也只是使用其低8位是吗?

是的。第二个截图,已经说的很详细了,摘录如下:

Depending on the data frame format selection bit (DFF in SPI_CR1 register), the data sent or received is either 8-bit or 16-bit. This selection has to be made before enabling the SPI to ensure correct operation.

For an 8-bit data frame, the buffers are 8-bit and only the LSB of the register (SPI_DR[7:0]) is used for transmission/reception. When in reception mode, the MSB of the register (SPI_DR[15:8]) is forced to 0.
For a 16-bit data frame, the buffers are 16-bit and the entire register, SPI_DR[15:0] is used for transmission/reception.



一周热门 更多>