AnsweredAssumed Answered

21368 SPI DMA - extra cycle?

Question asked by Laz on Sep 16, 2009
Latest reply on Sep 17, 2009 by Laz

I am using the SPI to talk to a 4-channel ADC.  I have configured it to be a Master Receive with DMA of 4 16-bit values.  Everything appears to be working correctly, except I seem to be getting 5 * 16 clock pulses.

 

My code:

 

initSPIB ()

{

 

*pSPIBAUDB = 0x08; // 12.5MHz

// 16 bits, no CS Flag, Master mode
*pSPICTLB = TIMOD2 | WL16 | MSBF | CLKPL | SPIMS | SMLS | SPIEN;

interruptf(SIG_SPIL, dmaISR);

}

 

UINT readBuffer[4];

readADC ()

{


*pIISPIB = (UINT)(&readBuffer); // recast the
*pIMSPIB = 1; // single int increment
*pCSPIB = 4; // read 4 values

// set DMA to receive and interrupt
*pSPIDMACB = SPIDEN | SPIRCV | INTEN;
}

 

As an experiment, I set CSPIB = 3, and observed 4 * 16 clock pulses, but only 3 values stored in the readBuffer.

 

Any ideas?

Attachments

Outcomes