LPC54101 SPI Slave Bytes Received

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC54101 SPI Slave Bytes Received

Jump to solution
601 Views
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

Labels (2)
0 Kudos
1 Solution
436 Views
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".  

View solution in original post

1 Reply
437 Views
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".