LPC54101 SPI Slave Bytes Received

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC54101 SPI Slave Bytes Received

ソリューションへジャンプ
637件の閲覧回数
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 解決策
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".  

元の投稿で解決策を見る

1 返信
473件の閲覧回数
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".