cancel
Showing results for 
Search instead for 
Did you mean: 

SSP receive with DMA

mt-i-euk
Associate II
Posted on July 23, 2007 at 10:32

SSP receive with DMA

6 REPLIES 6
mt-i-euk
Associate II
Posted on May 17, 2011 at 09:33

Hi,

I´m trying to implement SSP communication with SSP.

My sending function works fine, but the receiving don´t works.

Here´s my code:

SCU_AHBPeriphClockConfig(__DMA,ENABLE);

DMA_DeInit();

DMA_Cmd(ENABLE);

DMA_SyncConfig(SSP_DMA_Receive, ENABLE);

//receive

DMA_StructInit(&DMA_InitStruct);

DMA_InitStruct.DMA_Channel_LLstItm=0;

DMA_InitStruct.DMA_Channel_SrcAdd=(u32)((&SSP0->DR));

DMA_InitStruct.DMA_Channel_DesAdd=(u32)(&SSP0_Buffer_Rx[0]);

DMA_InitStruct.DMA_Channel_SrcWidth= DMA_SrcWidth_Byte;

DMA_InitStruct.DMA_Channel_DesWidth= DMA_DesWidth_Byte;

DMA_InitStruct.DMA_Channel_FlowCntrl= DMA_FlowCntrl2_DMA ;

DMA_InitStruct.DMA_Channel_Des = DMA_DES_SSP0_RX ;

DMA_InitStruct.DMA_Channel_TrsfSize =8;

DMA_ChannelSRCIncConfig (DMA_Channel5, DISABLE);

DMA_ChannelDESIncConfig (DMA_Channel5, ENABLE);

DMA_ChannelBuffering(DMA_Channel5, ENABLE);

DMA_Init(DMA_Channel5,&DMA_InitStruct);

DMA_ChannelCmd (DMA_Channel5,ENABLE);

Unfortunately i have initialized the SSP. Without DMA my code works. I have tested it.

Is there any bug in the code or a value missing?

greeni

Posted on May 17, 2011 at 09:33

Hi Greeni,

did you set the dma in the ssp register?

mt-i-euk
Associate II
Posted on May 17, 2011 at 09:33

Of course I did, now it works, but when i´m sending dummy data via DMA_SSP and try to receive Data via SSP i only get the Dummy Data i sent out. I have Disabeld the loopback mode.

Any suggestion why??

thanks.

greeni

seawwh
Associate II
Posted on May 17, 2011 at 09:33

your SSP Rx with DMA code is OK now ?

I have got a problem when use DMA for both SSP0 Rx an Tx!

seawwh
Associate II
Posted on May 17, 2011 at 09:33

Hi greeni,

DMA_InitStruct.DMA_Channel_Des = DMA_DES_SSP0_RX ;

should be:

DMA_InitStruct.DMA_Channel_Src = DMA_SRC_SSP0_RX;

gkruger
Associate II
Posted on May 17, 2011 at 09:33

Hi I hope you guys can help.

I am trying to receive data from an external ADC on SPI using DMA. I need to receive 3 bytes. I have used two DMA channels one to transmit 3 bytes and another to receive the incoming data. The problem is that the nss line is going high after every byte transmitted(and it needs to stay low). Is there any way that I can set the nss pin to only go high after 3 bytes?

Before switching to DMA I used another GPIO pin to do the chip select. But with DMA I don't think that is possible?

The reason I want to use DMA is that I am sending out bytes on the other SPI bus at the same time as I would like to receive data (triggered by timer) Any suggestions?

Kind Regards,

Gert