spi's dma mode receive data successfully but send data failed.

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

spi's dma mode receive data successfully but send data failed.

1,562 Views
vanaua
Contributor I

Dear all:

   I had a problem with using spi's dma mode for host and slave communication. I did not use the SDK, but programmed it directly by reading and writing registers . In the following code,  I tried to use s32k116 that was set as a slave device to  communicate with the external spi host device,however, While the host  keeps sending 128 bytes of data, the slave DMA receive interrupt could be triggered and receive data from the host, however, the oscilloscope found that the output pin from the slave machine shows no waveform, In other words, DMA transmiting of slave failed.could you help me find out where the problem is? Thank you very much.

Labels (1)
0 Kudos
6 Replies

1,299 Views
vanaua
Contributor I

What's more, Whether LPSPI slaves support sending DMA messages or not was still confusing me, But I was following the manual of S32K-RM.

TIM截图20200526094723.jpg

TIM截图20200526094749.jpg

0 Kudos

1,299 Views
vanaua
Contributor I

According to my understanding, Data from the array of TCD1_Send was transmitted to the register of LPSPI0 - > TDR  in the channel 1 of DMA .And in fact, the channel is sent with receiving channel under one same clock, so  when receiving channel 0 transmission complete interruption was trigged, channel 1 send has been completed as well. However,  I don't see any output data sent from the pin during this  period. 

0 Kudos

1,299 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello vanaua@163.com,

I just quickly tested your code and there is a configuration error in the DMA ch0.

pastedImage_1.png

BR, Daniel

0 Kudos

1,299 Views
vanaua
Contributor I

Hi, Thank you for your reply. I found that there was a error with the code I uploaded earlier. Such as

DMA->TCD[0].SADDR = DMA_TCD_SADDR_SADDR(&(LPSPI0->RDR)); /* Source Address. */

and the other.(the red is correct)

I have changed it to be more perfect. However, slave's LPSPI communication with DMA can only receive data, but cannot send data. I can not figure out what kind of BUG cause this error.

0 Kudos

1,299 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi vanaua@163.com,

You didn't enabled peripheral request for DMA Ch1, you enabled DMA Ch0 only (SERQ).

Do you measure the correct pin?

In the project, you commented that MISO is PTD16 but it is PB4. 

Do you use your own board or an EVB?

BR, Daniel

0 Kudos

1,299 Views
vanaua
Contributor I
0 Kudos