您好,我用DMA接口两个DSPIC33 EP的过SPI。传输工作很好,我有一个关于我处理CS的方式的问题。我这样做了。-在启用DMA i之前,设置一个定时器。在DMA传输中完成中断,启用定时器,一旦定时器中断拉CS高,禁用
timeReTe看起来像是浪费资源。有没有更好的处理CS线的方法?如果我在DMA传输完全中断中拉CS高,定时的时间有时太快,并且接收端不能得到整个传输。因此,我需要延迟切换CS,因此计时器。如何处理DMA的CS?
以上来自于百度翻译
以下为原文
Hello,
I am interfacing two dspic33ep's over SPI with DMA. The transfer works fine, I have a question about the way I handle the CS.
The way I do it is;
- Setup up a timer
- before enabling the DMA I pull the CS low.
- in DMA transfer complete interrupt, enable timer,
- once timer interrupts pull CS high, disable timer
This seems like a waste of resources. Is there a better way of handling the CS line ?
If I pull the CS high in DMA transfer complete interrupt, timing wise it is sometimes too soon, and the receiving side doesn't get the whole transfer. So it seems I need to delay toggling the CS, thus the timer.
How do you handle CS with DMA ?