Tool/software: Code Composer Studio
Hi,
I am working with RM57Lxxx development board on compatability SPI with DMA.
I am using SPI two SPI's----SPI1-MASTER and SPI-2 as SLAVE.
SPI-1 is working in external loop back (MOSI and MISO pins are shorted in SPI-1.) SPI-2 SIMO pin is connected to SPI-1 of MOSI pin.
Chip select SCS[0] is connected from SPI-1 to SPI-2. This means When master SPI-1 transfer 260 bytes of data, the same 260 Bytes data master SPI-1 is received through loop back and also received by the slave SPI-2.
I configured DMA transfer to master SPI-1 as well as DMA receive to SPI-1 and DMA receive to SPI-2.
1.DMA_CH0 is configured to get SPI-1 TX DMA request DMA_REQ1
source and destination address for DMA SPI-1 TX is
g_dmaSpiTxCTRLPKT1.SADD = ((uint32_t) (u8_transBuffer));
g_dmaSpiTxCTRLPKT1.DADD =(uint32) (&(spiREG1->DAT1));
Question:
In the DMA control packet configuration for destination address whether I have to use SPI-1 DAT0 or SPI-1 DAT1 register for transferring data thru SPI.
If DAT0 register used how the Chip selection will be done when DMA is used with SPI in transferring the data. For example If I have two slaves and I have to use SPI with DMA how chip selection need to be done?
If DAT1 register used how the control field location are written in DAT1 register. Before Enabling DMA request I need to write DAT1 control field
spiREG1->DAT1 = ((uint32)FALSE << 28U)
| ((uint32)FALSE << 26U)
| ((uint32)SPI_FMT_0 << 24U)
| ((uint32)SPI_CS_0 << 16U) ; then enable DMA request in INT0 register
2.DMA_CH2 is configured to get SPI-1 RX DMA request DMA_REQ0
Source and destination address for DMA SPI-1 RX
g_dmaSpiRxCTRLPKT2.SADD = ((uint32)(&(spiREG1->BUF))); /* source address which is nothing but RAM location */
g_dmaSpiRxCTRLPKT2.DADD = ((uint32) (u8_receiBuffer1)); /* destination address which is nothing but RAM location*/
3.DMA_CH3 is configured to get SPI-2 RX DMA request DMA_REQ2
Source and destination address for DMA SPI-2 RX
g_dmaSpiRxCTRLPKT2.SADD = ((uint32)(&(spiREG2->BUF))); /* source address which is nothing but RAM location */
g_dmaSpiRxCTRLPKT2.DADD = ((uint32) (u8_receiBuffer2)); /* destination address which is nothing but RAM location*/
Question:
I am unable to receive the data in u8_receiBuffer2 buffer location but receiving the data u8_receiBuffer1 buffer location. Why DMA is not triggering SPI-2 RX request? When I checked the SPI-2 RX buffer register the chip select fields are ZERO.
Request you to help me in this regard.
Thanking you
Praveen