Hello. I am developing diploma thesis with TMS570LS3137. I need to configure SPI4 peripherial (NOT mibSPI) to send 16 uint16 data words. I have sucessfully configured SCI with DMA and this seems to be not the same. Polling method works - all words I want to are sent. But, the DMA does not work.
SPI dataconfig set before. DMA enabled before. SPI data transfer with polling method before this ok.
/* Configure DMA for transfer */
g_dmaCTRLPKT_A4960Tx.SADD = (uint32) &A4960reg[0][0]; /* source address */
g_dmaCTRLPKT_A4960Tx.DADD = (uint32) &spiREG4->DAT1; /* destination address */
g_dmaCTRLPKT_A4960Tx.CHCTRL = 0; /* channel control */
g_dmaCTRLPKT_A4960Tx.FRCNT = 1; /* frame count */
g_dmaCTRLPKT_A4960Tx.ELCNT = 16; /* element count */
g_dmaCTRLPKT_A4960Tx.ELDOFFSET = 4; /* element destination offset */
g_dmaCTRLPKT_A4960Tx.ELSOFFSET = 0; /* element source offset */
g_dmaCTRLPKT_A4960Tx.FRDOFFSET = 0; /* frame destination offset */
g_dmaCTRLPKT_A4960Tx.FRSOFFSET = 0; /* frame source offset */
g_dmaCTRLPKT_A4960Tx.PORTASGN = 4; /* port b */
g_dmaCTRLPKT_A4960Tx.RDSIZE = ACCESS_16_BIT; /* read size */
g_dmaCTRLPKT_A4960Tx.WRSIZE = ACCESS_16_BIT; /* write size */
g_dmaCTRLPKT_A4960Tx.TTYPE = FRAME_TRANSFER ; /* transfer type */
g_dmaCTRLPKT_A4960Tx.ADDMODERD = ADDR_INC1; /* address mode read */
g_dmaCTRLPKT_A4960Tx.ADDMODEWR = ADDR_FIXED; /* address mode write */
g_dmaCTRLPKT_A4960Tx.AUTOINIT = AUTOINIT_OFF; /* autoinit */
dmaSetCtrlPacket(DMA_CH1, g_dmaCTRLPKT_A4960Tx);
dmaReqAssign(DMA_CH1, 25U);
dmaEnableInterrupt(DMA_CH1, FTC);
dmaSetChEnable(DMA_CH1, DMA_HW);
spiREG4->INT0 = (1<<16);
I have a few questions.
1. What the "element destination offset means"? Is this good for offset in the destination memory, for example SPI Tx buffer DAT1 consist of CSHOLD, WDEL, CFSEL, CSNR, and TXDATA [15..0]. With the respect of endianity (big endian) the data word uint16 should be written to address not &spiREG4->DAT1, but .. which? And is the value number of bits, bytes, or the WRSIZE? Or am I wrong?
2. DMA enable. spnu499b, page 554: "DMA enable bit. The configuration registers and channel control packets should be setup
first before DMA_EN bit is set to one to prevent state machines from carrying out bus
transactions. If DMA_EN bit is cleared in the middle of an bus transaction, the state
machine will stop at an arbitration boundary."
I can't imagine, that I will have to "pause or stop" all dma transfers in application to reconfigure one control packet.
Please help.
Thanks
Milan