好几天了,一直没搞定,SPI1单字节收发正常(采用回环模式),加上EDMA3后,收发没有任何反映,但EDMA参数RAM19(SPI1的发送)在触发EDMA发送后被清零。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
好几天了,一直没搞定,SPI1单字节收发正常(采用回环模式),加上EDMA3后,收发没有任何反映,但EDMA参数RAM19(SPI1的发送)在触发EDMA发送后被清零。
好的。这部分代码两个CPU是否完全兼容?
感觉6747的资料比6748、137\138这些少,想用同系列芯片的程序,又不知道哪些不兼容,怕出了问题不好查~~
我比较了C6747, C6748的SPI, EDMA寄存器是一样的,可以用C6748的这部分代码。
另外,简单点的话,可以参考rCSL里的EDMA例程。
http://processors.wiki.ti.com/index.php/QuickStartOMAPL1x_rCSL
采用C6748 starterware里的SPI EDMA例程做了测试,发现触发EDMA发送后,发送通道参数ram的源地址加了1、CNT减了1,接收通道没有变化,可能会是哪里的问题呢?
SPI单字节收发正常,SPI的DMA请求也开启了,还有什么可能的原因呢?
debug了一下,发现ESR|=1<<19操作后,发送缓存里的数据没有被写入SPI1_SPIDAT1(通过判断SPI1_SPIFLG的bit8是否置1来等待一段时间,stop仿真器后读取SPI1_SPIDAT1)。
而采用SPI1_SPIDAT1=0x05,再等待SPI1_SPIFLG的bit8置1,SPI1_SPIDAT1与SPI1_SPIBUF里面的值都是0x05。
搞定了。
看EDMA3的user's guide,说c674x不支持固定源/目的地址模式。
一直以为,SPI的发送/接收数据寄存器地址是固定的,所以需要设为固定地址模式。真坑!
但有个疑问,为什么用A同步,必须ACNT=1、BCNT=N,而不是ACNT=N、BCAN=1??
SPI_EDMA例程里设了index=0。
SPI是一个一个数据去触发EDMA事件的,所以ACNT=1。
When a character is to be transmitted the SPI module signals the DMA via the XEVT signal. The DMA
controller then transfers the data from the source buffer into the SPI transmit data register (SPIDAT1).
When a character is received, the SPI module signals the DMA via the REVT signal. The DMA controller
then reads the data from the SPI receive buffer register (SPIBUF) and transfers it to a destination buffer
for ready access.