LPC54101 SPI Slave Bytes Received

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC54101 SPI Slave Bytes Received

跳至解决方案
636 次查看
dmfen
Contributor I

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

标签 (2)
0 项奖励
1 解答
471 次查看
Dezheng_Tang
NXP Employee
NXP Employee

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".  

在原帖中查看解决方案

1 回复
472 次查看
Dezheng_Tang
NXP Employee
NXP Employee

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".