TI中文支持网
TI专业的中文技术问题搜集分享网站

c6748 SPI接多个从设备

C6748 用的SPI1口,现需用SPI1_SCS[0]与SPI1_SCS[1]控制两个从设备。

我看了有关SPI的寄存器,没有相关的寄存器设置能做到下面功能。

比如:我写一个数据,我需要自动切换SPI1_SCS[0]与SPI1_SCS[1],这一步如何能实现?

Nancy Wang:

可以通过改变SPIDAT1.CSNR来实现切换。
请参考starterware中spi代码。
processors.wiki.ti.com/…/StarterWare_SPI
Selecting CS pin to be driven, Format Register to be used and asserting CS pin is achieved using SPIDat1config().

user6310626:

回复 Nancy Wang:

SPIBUF中的TXBUF RXBUF分别有多大啊?

Nancy Wang:

回复 user6310626:

具体请查看TRM 28.2.11.1 Character Length
Character length 2 to 16 bits.
Transmit data is written to SPIDAT1. The transmit data must be written right-justified irrespective of the character length. The SPI automatically sends out the data correctly based on the chosen data format.
The data received in SPIBUF is right-justified irrespective of the character length and is padded with 0s when character length is less than 16

user6310626:

回复 Nancy Wang:

我指的是如图中所示的,TXBUF RXBUF的大小. 也就是比如RX收多少个字节,才会RXFULL

Nancy Wang:

回复 user6310626:

buffer大小是16bit.看一下手册图6-36.

赞(0)
未经允许不得转载:TI中文支持网 » c6748 SPI接多个从设备
分享到: 更多 (0)