AnsweredAssumed Answered

SPORT DMA transmit zero

Question asked by Natasha on May 14, 2013
Latest reply on Aug 27, 2015 by Harshit.Gaharwar
Branched to a new discussion

Hi! I have a problem with SPORT DMA ADSP-21489. Please help me.

I want transmit word 0xAA55. Sometimes transferred wrong zero (or nothing) but CLK is present.

 

SPORT0 initialization:

void InitSPORT0_TX(void) //Internal - > SPORT0

{

      int clkdiv,fsdiv;

 

      //Clear the SPORT control registers (SPCTL0) which flushes the buffers

     *pSPCTL0 = 0;

     asm("nop;nop;nop;nop;nop;nop;nop;");

 

     //Fastest serial clock speed is fine for the minimum timings

     clkdiv= 0x09;//SLEN-1

     fsdiv = 0x1F;

 

     // Divisor register for FS and CLK

     *pDIV0 = (fsdiv<<16)|(clkdiv<<1); //internal CLK

 

     // Sport0 (Tx) control register setup

     *pSPCTL0 = (SPEN_A | DTYPE1 | SLEN16 | ICLK | CKRE |LAFS| FSR | IFS | SDEN_A | SPTRAN);

 

    //Init_dma_register_tx:

    *pIISP0A = (unsigned int)RMS - 0x80000;

    *pIMSP0A = 1;

    *pCSP0A  = 1;

     return;

}

 

SRU initialization:

void SRU_init(void)

{

  SRU(SPORT0_CLK_O,SPORT0_CLK_I);

          SRU(SPORT0_FS_O,SPORT0_FS_I);

          SRU(SPORT0_DA_O,SPORT0_DA_I);

  SRU(HIGH,PBEN01_I);

          SRU(SPORT0_DA_O,DAI_PB01_I);

  SRU(HIGH,PBEN02_I);

          SRU(SPORT0_CLK_O,DAI_PB02_I); //SPORT master (12.5 MHz)

  SRU(HIGH,PBEN03_I);

          SRU(SPORT0_FS_O,DAI_PB03_I);

 

return;

}

 

void SPORT0_isr(int sig_int)

{

   done = true;

          *pSPCTL0 = *pSPCTL0 ^ SPEN_A;

          *pSPCTL0 = *pSPCTL0 ^ SDEN_A;

 

   return;

}

 

int done=true;

int RMS=0xCC;

void main(void)

{

SRU_init();

InitSPORT0_TX();

interrupt(SIG_P6, SPORT0_isr);

InitSPORT1_RX();

 

sysreg_bit_set(sysreg_MODE1, IRPTEN );/* enable global interrupts */

  asm("nop;nop;");

 

while(1)

{

     if(done)

    {

       done = false;

      *pSPCTL0 = (SPEN_A | DTYPE1 | SLEN16 | ICLK | CKRE |LAFS| FSR | IFS | SDEN_A | SPTRAN);

      //Init_dma:

      *pIISP0A = (unsigned int)&RMS - 0x80000;

               *pIMSP0A = 1;//modifier external adress

               *pCSP0A  = 1;//count word for transmit

 

      }

}

}

 

 

Here are the settings Sport1:

 

section("seg_dmda") int A0[64];

section("seg_dmda") int A1[sizeof(A0)];

int TCB_A0[4] = { 0, (sizeof(A0)), 1, 0};

int TCB_A1[4] = { 0, (sizeof(A0)), 1, 0};

 

unsigned int PCI = 0x00080000 ;

unsigned int OFFSET = 0x00080000 ;

 

 

void InitSPORT1_RX(void)

{

     //Clear the chain pointer register SPORT1A

    *pCPSP1A = 0;

 

    //Clear the SPORT1 control registers (SPCTL1) which flushes the buffers

    *pSPCTL1 = 0; 

 

    // For internal memory transfers, set up all TCBs in internal memory

    //Proceed from Block A0 to Block A1

    TCB_A0[0] = (unsigned int) TCB_A1 + 3 - OFFSET + PCI ;

    TCB_A0[3] = (int) A0 - OFFSET;

 

    //Proceed from Block A1 to Block A0

    TCB_A1[0] = (unsigned int) TCB_A0 + 3 - OFFSET + PCI ;

    TCB_A1[3] = (int) A1 - OFFSET;

 

    // External clock and frame syncs generated by ADC

    *pDIV1 = 0x00000000;  // Receiver (SPORT1)

 

    // Enabling DMA Chaining for SPORT1 RX

    //Write the address containing the index register value of the first

    //TCB to the chain pointer register, which starts the chain.

    *pCPSP1A = (unsigned int)TCB_A0 - OFFSET + 3;

 

          // Sport1 (Rx) control register setup

    *pSPCTL1 = (SPEN_A | DTYPE1 | SLEN16 | CKRE | FSR | SDEN_A | SCHEN_A);

 

  return;

}

 

This code is not working properly, if enabled Sport1 to receive codes from the external ADC. When SPORT1 (RX) - disabled, SPORT0 (TX) - work good.  Please help me understand why sport1 violates the issuance sport0.

Outcomes