RX SSP with DMA

cancel
Showing results for 
Search instead for 
Did you mean: 

RX SSP with DMA

132 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Mon Jun 09 08:20:37 MST 2014
i want to read per dma from spi-slave-device.

When it take the nxp-sspdma-example in rx-Configuration, it happens nothing, because the slave does not send himself. The master must send to receive from the slave. I have to choose tx-dma.configuration, even when i want rx?

this is my code for receiving per dma+ssp. is it right????

void DMA3_transfer_from_SSP0_to_buffer(u8 count){
LPC_SC->DMAREQSEL =  0;//SC_DMASEL_timer0_MATCH1_notUART0rx;//i.V.m. DMAC_SRC_PERIP(9)LPC_GPDMACH0->DMACCConfig
LPC_SC->PCONP |= (1<<29);//Enable clock to DMA controller
LPC_GPDMA->DMACConfig=DMAC_CTRL_ENABLE;
LPC_SSP0->DMACR=SSPxTxDMAenable;// ->DMACR=2;//tx en//176x

LPC_GPDMACH3->DMACCSrcAddr = &(LPC_SSP0->DR);
LPC_GPDMACH3->DMACCDestAddr = buffer+4;
LPC_GPDMACH3->DMACCControl =(0
 |DMAC_CHAN_INT_TC_EN
// |DMAC_CHAN_SRC_AUTOINC
 |DMAC_CHAN_SRC_WIDTH_8
 |DMAC_CHAN_SRC_BURST_1
 |DMAC_CHAN_DEST_AUTOINC
 |DMAC_CHAN_DEST_WIDTH_8
 |DMAC_CHAN_DEST_BURST_1
 |DMAC_CHAN_TRANSFER_SIZE(count)
 );

  LPC_GPDMACH3->DMACCConfig =(0
  | DMA_CHAN_IE_ITC_EN
//   | DMAC_CHAN_FLOW_D_M2M
//  | DMAC_CHAN_FLOW_D_M2P //!!!!!!!!!!!!!! ??????????????
  | DMAC_CHAN_FLOW_D_P2M
  | DMAC_SRC_PERIP(DMA_REQUEST_SSP0_TX)
//  | DMAC_SRC_PERIP(9)
//  | 1<<1//DMAC_SRC_PERIP(DMA_REQUEST_SSP0_RX)
//  | DMAC_DEST_PERIP(DMA_REQUEST_SSP0_TX)
//  | DMAC_DEST_PERIP(DMA_REQUEST_SSP0_RX)
  );
}

Labels (1)
0 Kudos
2 Replies

58 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Mon Jun 09 13:26:48 MST 2014
thanks for answering.  The posted code seems to be woking. it seems that dma-destination gets data from the rx-fifo while dma-source is the tx-fifo.
0 Kudos

58 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Mon Jun 09 12:53:46 MST 2014
SPI must transmit something (often dummy data) to receive
so you need 2 DMA, both tx & rx
DMA tx number of byte you want to rx
0 Kudos