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

LP-AM243: SDK的例程mcspi_loopback_dma_am243x-lp_r5fss0-0_nortos_ti-arm-clang是SPI Master的,修改成SPI Slave用的过程中有问题。

Part Number:LP-AM243

先在syscfg里配置成Slave,配置情况如下图:D0 pin(A8)是MOSI,D1 pin(C9)是MISO,B8是CLK,B7是CS。

代码用的是mcspi_loopback_dma_am243x-lp_r5fss0-0_nortos_ti-arm-clang的代码,基本没啥改动,如下图:用的是DMA的方式+Blocking,在SPI主发送数据前,先调用MCSPI_transfer函数,然后等待SPI主开始发送数据,如果SPI从的DMA接收到数据后,就会解除Blocking。但是现在SPI从没有收发到任何数据,经过逻辑分析仪分析,SPI主是已经发出数据了的。请问哪里有问题?

Shine:

做slave时,需要注意下面的guideline。

The MIBSPI protocol does not account for a built-in handshaking mechanism and neither does this driver. Therefore, when operating in SLAVE mode, the application must provide such a mechanism to ensure that the MIBSPI slave is ready for the MIBSPI master. The MIBSPI slave must call MIBSPI_transfer() before the master starts transmitting. Some example application mechanisms could include:
Timed delays on the MIBSPI master to guarantee the MIBSPI slave is ready for a MIBSPI transaction.
A form of GPIO flow control from the slave to the MIBSPI master to notify the master when ready.

https://software-dl.ti.com/mcu-plus-sdk/esd/AM273X/08_01_01_06/exports/docs/api_guide_am273x/DRIVERS_MIBSPI_PAGE.html

,

Xiaolin GU:

我使用的时候已经注意到了这一点,在SPI Master开始传输之前,SPI从设备先调用了 MCSPI_transfer(),然后等待SPI Master传输数据,但是SPI从一直没收到SPI Master过来的数据,所以程序始终是在等待信号量的状态,但是我连上逻辑分析仪可以看到SPI Master是发出数据了的。

,

Shine:

请问SPI slave模式下,发送可以吗?还是只是不能接收?

,

Xiaolin GU:

发送和接收都不可以

,

Shine:

发送的时候,时序对吗?能发出数据么?

赞(0)
未经允许不得转载:TI中文支持网 » LP-AM243: SDK的例程mcspi_loopback_dma_am243x-lp_r5fss0-0_nortos_ti-arm-clang是SPI Master的,修改成SPI Slave用的过程中有问题。
分享到: 更多 (0)