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.

About DM365 DMA channel (Programe base on DM365IPNC)

Genius 3400 points

Hi All:

Referrence DM365 EVM, I build my DM365 Board. In my board, I use SPI0(config to slave and DMA mode) to communicate with other CPU.

I can request DMA and communicate successfully when only run SPI communicate program. But once run av_capture(It's base on communicate), SPI communicate program cannot run successfully and request DMA failed.

      if (davinci_request_dma(spi_slave->dma_channels.dma_tx_sync_dev, "SPISlave TX",
                             davinci_spislave_dma_tx_callback, 
                             dev, 
                             &dev->dma_channels.dma_tx_channel, 
                             &tcc, 
                             dev->dma_channels.eventq)) 
   {
               printk("Unable to request DMA channel for MibSPI TX\n.\n"); 
               return; 
    }

    and spi0 DMA channel number is 16.

    I don't know what's problem. is it conflict with av_capture?

    Thanks a lot

  • Hi,

    AV_server requests for multiple dma channels for its operations. H.264/MPEG4/JPEG encoder also need DMA channels and all of these requests are done through davinci_request_dma API.

    Now, you need specifically channel number 16 for SPI and it might be possible that when AV_server or the encoders request DMA channels, they have already taken channel 16. We ask for EDMA_DMA_CHANNEL_ANY which means the API will provide us any available channel.

    As you want channel 16 specifically, i would suggest following two approaches.

    1. Take this channel at the beginning before av_server is started and keep this channel allocated for ever for the SPI. Never release it.

    2. Instead of requesting the channel using davinci_dma_request, you can directly reserve this channel in the kernel in the edma.h file of LSP and keep on accessing this channel for the SPI driver. This is the way it is done for MMC/SD driver or McBSP driver.

    Hope this helps.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think it has answered your question. Thanks.

  • Hi:

          Thanks your reply at first!

          According your advice 1, I can request DMA channels, and DMA channel 16,17 have been used to SPI0 TX and RX DMA channel. But now I meet a new problem.

          1. Request SPI0  DMA channels like this:

               if (davinci_request_dma(spi_slave->dma_channels.dma_tx_sync_dev, "SPISlave TX", 
                               davinci_spislave_dma_tx_callback, dev,  &dev->dma_channels.dma_tx_channel, &tcc,   0))   //  designate process queue is 0

            and I run spi0_test to receive data form other chip, and at same time , I run program ./syster_server &,  and my SPI0 test cannot often respond to EDMA callback function and cannot receive data.

            2 .When modify system server, delete H264 encodec function, My SPI0 work normally.

                4289 root 1000 S ./system_server 
                4299 root 2548 S ./av_server.out 5MP_720P DM365 4000000 VBR MENUO

            3.Through modify the function of DMA_copyFillCreate() DMA_demuxCreate() in drv.ko,  modify the process queue to 2 (old is 0) when request DMA channel using davinci_request_dma(). Only run edma test program (IPNC support) and SPI1 test,  and the SPI test program can receive better, but it's still wrong, 5 times wrong in 700 times receive data.   And run system server, the wong is still offen happend.

             Have any good idea about DMA dispatch?

            Thanks again.

     

     

     

     

  • Hi,

    Is your SPI on DM365 acting as master or slave? Can you try putting SPI DMA channel to some other TC queue instead of 0? Codec uses queue 0, 1 and 2 and all these queues are heavily loaded in codec operation. Queue 1 is relatively less loaded and queue 3 is not used by codec.

    Regards,

    Anshuman

     

  • Thanks you for your reply!

    I'm using SPI0 activing as slave, and it communicate with DM648 SPI master.

    Following your advice to using queue 3,  and don't modify codec using queue, then run spo_test and av_server together, it work better than before,  but there are still 10 times wrong in 4000 times received and sended data. And the wrong is that cannot receive data or have difference between send and receive data.

    Have more better  advices?

    Thanks again.

     

     

  • Hi,

    As SPI is in slave mode, if you dont have any rate control mechanism, it is possible that we miss on some packets. My suggestion is to make a more robust SPI protocol with rate control support, where in DM365 sends ACK for every data received before DM648 sends next packet.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think it has answered your question. Thanks.