-1

I am transferring 10 bytes from master to slave over SPI+DMA with HAL. How can I check whether how many bytes the receiver has at that moment and if all the 10 byte has not been received then stops the process again. Because the master after sending 10 bytes should get an answer from slave but if the slave has not received full byte it waits and system go in indifinite.......

Any idea??

4

1 回答 1

0

"I am transferring 10 bytes from master to slave over SPI+DMA with HAL." Since you use DMA you just config transfer size to DMA receiver API and enable DMA interrupt. When DMA receive 10 bytes the DMA receiver complete interrput will arrive except that the sender transfer less than 10 bytes.

"Because the master after sending 10 bytes should get an answer from slave but if the slave has not received full byte it waits and system go in indifinite......." You can solve this problem by using timeout mechanism in the slave side.

于 2016-05-11T10:58:59.103 回答