#1楼主:请教2线SPI收发切换问题
文章发表于:2008-08-11 05:12
SPI采用2线方式工作(数据收发共用MISO,即工作在从模式下),需要进行接收和发送操作,请问在切换的时候需要关闭SPI再进行切换吗?没有找到相关说明。切换过程如何操作可以给以说明吗?谢谢!
#3
文章发表于:2008-08-14 21:23
请看STM32技术参考手册中有关SPI的章节,下面是相关部分(第545页):
22.3.4 Simplex communication
The SPI is capable of operating in simplex mode in 2 configurations.
● 1 clock and 1 bidirectional data wire
● 1 clock and 1 data wire (receive-only in full-duplex mode)
1 clock and 1 bidirectional data wire
This mode is enabled by setting the BIDIMODE bit in the SPI_CR1 register. In this mode SCK is used for the clock and MOSI in master or MISO in slave mode is used for data communication. The transfer direction (Input/Output) is selected by the BIDIOE bit in the SPI_CR2 register. When this bit is 1, the data line is output otherwise it is input.
#4
文章发表于:2008-08-21 12:42
自己回答一下吧,不必关闭SPI,可以直接切换方向,我试过了。