Hi There,
We have our LPC54101 processor acting as an SPI slave, configured to use DMA. When receiving an SPI frame from the SPI master, we don't know what length of data we will receive, only that it is of a certain maximum length. So we put this maximum length into the XFERCOUNT register, and track the completion of the SPI transfer by monitoring the SPI chip select line.
We currently do not know how to get the number of bytes actually transferred by the DMA, is there a register we can read to find out this?
Cheers,
Donal
已解决! 转到解答。
As slave, if you don't know the exact length the master is going to send you, having SSEL as a pin interrupt to monitor the completion of DMA is the right thing to do. I recall XFERCOUNT field of Channel transfer configuration registers
should be updated when the SSEL interrupt occurs, if you set XFERCOUNT to max to begin with, say "MAX", on completion of SSEL interrupt, XFERCOUNT reading is "x", the number of bytes transfered by DMA is "MAX-x-1".
As slave, if you don't know the exact length the master is going to send you, having SSEL as a pin interrupt to monitor the completion of DMA is the right thing to do. I recall XFERCOUNT field of Channel transfer configuration registers
should be updated when the SSEL interrupt occurs, if you set XFERCOUNT to max to begin with, say "MAX", on completion of SSEL interrupt, XFERCOUNT reading is "x", the number of bytes transfered by DMA is "MAX-x-1".