AnsweredAssumed Answered

[BF538, SPI Slave Rx, DMA] What did I wrong?

Question asked by Smolny Employee on Mar 18, 2010
Latest reply on Mar 19, 2010 by gvasanth

Can't receive bit stream with SPI.

 

volatile unsigned char RCV_Data[1024];

void Init_DMA(void)

{

     /* Set up DMA0 to receive, map DMA0 to SPI0 */

     *pDMA0_PERIPHERAL_MAP = 0x5000;

     *pDMA0_CONFIG = FLOW_AUTO | DI_EN | WDSIZE_8 | WNR;

 

     /* Start address of DMA0 data buffer */

     *pDMA0_START_ADDR = (void *)RCV_Data;

 

     /* DMA0 inner loop count */

     *pDMA0_X_COUNT = 1024;

 

     /* Inner loop address increment, stride shown in byte increments */

     *pDMA0_X_MODIFY     = 1;

}

 

EX_INTERRUPT_HANDLER(SPI0_ISR)

{

// Some SPI Core Code

}

 

int main()

{

     *pIMASK           = 0x050F;    

     *pSIC_IMASK      = 0x00002100;

     Init_DMA();

     *pDMA0_CONFIG     = (*pDMA0_CONFIG | 0x0001);

     *pSPI0_CTL = 0x4C12; //Enable, Slave, Mode[1:0]=10 (SPI DMA Receive)

}

 

Right after enabling SPI, we jump to SPI interrupt routine, w/o transferring any data to DMA. What should I do to work with SPI DMA instead of SPI Core?

Outcomes