This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM365 Problem: capture video-> H264codec-> Sending MCBSP EDMA loses XEVT

/********************************************************/
INIT:
(MCBSP_CLKX=2.048MHz)

      davinci_mcbsp_write_reg(DAVINCI_MCBSP_PCR_REG, 0x00000001);
      davinci_mcbsp_write_reg(DAVINCI_MCBSP_SRGR_REG,0);
      davinci_mcbsp_write_reg(DAVINCI_MCBSP_SPCR_REG,0x03000000);


START:

      err = davinci_request_dma (2, "EDMA mcbsp tx",NULL, NULL, &master_ch_tx, &tcc,EVENTQ_0);
      davinci_dma_link_lch(master_ch_tx, master_ch_tx);
      davinci_stop_dma (master_ch_tx);

//      len=edmaparams.bcnt;
      len=256;
      tx_len=len;
      tx_adr=(unsigned long) edmaparams.src;

      davinci_set_dma_src_params (master_ch_tx,(unsigned long) edmaparams.src,0,0);
      davinci_set_dma_dest_params (master_ch_tx,DAVINCI_MCBSP_DXR_REG+DAVINCI_MCBSP_BASE,0,0);
      davinci_set_dma_src_index (master_ch_tx, 2, 0);   //b c
      davinci_set_dma_dest_index (master_ch_tx, 0, 0);  //b c
      davinci_set_dma_transfer_params (master_ch_tx, 2, len, 1, 0, ASYNC);
      davinci_get_dma_params (master_ch_tx, &paramentry);
      davinci_set_dma_params (master_ch_tx, &paramentry);
      if(len<129)
        {
          davinci_mcbsp_write_reg(DAVINCI_MCBSP_XCR_REG, 0x00010040+((len-1)<<8));
        }
      else
        {
          davinci_mcbsp_write_reg(DAVINCI_MCBSP_XCR_REG, 0x00010040+((128-1)<<8)+((len-128-1)<<24)+((0x2)<<21)+(1<<31));
        }

      davinci_start_dma (master_ch_tx);

      w = (davinci_mcbsp_read_reg(DAVINCI_MCBSP_SPCR_REG)&0xfffeffff)|0x10000; // start TX(XRST=1)
      davinci_mcbsp_write_reg(DAVINCI_MCBSP_SPCR_REG,w);

      /* start single signal FSX*/
      gpio_set_value(79, 1);
      gpio_set_value(79, 0);


Wait 1 second:


      davinci_dma_getposition(master_ch_tx, &src, &dst);
      if((tx_adr+(tx_len*2)-2)==src){
          printk(KERN_INFO ">>>Dma_end Ok\n");
        }
      else
        {
          printk(KERN_INFO ">>>Dma_error!!!\n");
        }
      w = davinci_mcbsp_read_reg(DAVINCI_MCBSP_SPCR_REG)&0xFFFEFFFF; // stop TX(XRST=0)
      davinci_mcbsp_write_reg(DAVINCI_MCBSP_SPCR_REG,w);
      davinci_stop_dma (master_ch_tx);
      davinci_free_dma (master_ch_tx);

/********************************************************/


If capture->H264codec->Sending MCBSP   ->>>>Dma_error!!!
If ONLY sending MCBSP                  ->>>>Dma_end Ok

EDMA loses XEVT.
Where a problem?
Thanks.

  • Aleksandr,

    I have a few clafirications needed on your questions.

    1) Which device are you using? dm355? dm365?

    2) When you say "EDMA loses XEVT." is this the first XEVT only or the last XEVT or which one?

    In general  you want to have the EDMA channel enabled before kicking off the Mcbsp enable and you also want to have the EDMA TC handling the Mcbsp to be set as highest priority in your system so race conditions don't occur.

    regards,

    miguel