SPI DMA in SLAVE MODE

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

SPI DMA in SLAVE MODE

919 Views
varunrajarangan
Contributor II

Hi,

I am trying to establish full duplex communication through SPI using DMA. So far I am able to receive data from master in blocks(256 bytes). But I am a bit confused in transmitting data back to master. Do I have to enable another channel for transmitting data? or Do I have to enable SPI interrupt? I am using KL05Z.

Please help me guys...

Regards

Varun R

Labels (1)
0 Kudos
4 Replies

541 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Varun,

You needn't wrong it at all. SPI supports full duplex communication and device can transmit and receive data simultaneously when it works in Master mode or Slave mode after you establish the connection likes the Fig 1.

Hope it helps.

2015-05-12_10-45-46.jpg

                                                                    Fig 1


Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

541 Views
varunrajarangan
Contributor II

Hi Jeremyzhou,

Thanks for the reply,

My application is in slave mode. I am using DMA to receive data blocks. But how do I put data in the SPI0_D register when working in DMA mode??

Regards

Varun

0 Kudos

541 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Varun,

The SPI module in KL05 supports both transmit and receive by DMA and about the detail configuration of the DMA integrate with SPI,

I'd highly recommend you should review the chapter 22  DMAMUX and chapter 23 DMA Controller Module in the reference manual.

After that, I think you will have a brief idea of the DMA operation, then we can talk about the detail configuration of the DMA integrate with SPI if you still don't make it.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

541 Views
varunrajarangan
Contributor II

Hi Jeremyzhou,

I got it right. :smileyhappy: I enabled another DMA channel for transmission. Now DMA0 handles SPI reception and DMA1 handles SPI transmission.

Regards

Varun R

0 Kudos