3 Replies Latest reply on May 23, 2018 7:33 PM by jameswagner

    FX3 DMA Manual Channel Latency

    jameswagner

      Hi all,

       

      I have the following DMA channels set up:

       

      1) An AUTO-SIGNAL channel from the GPIF (producer) to USB (consumer)

      2) A MANUAL channel from USB (producer) to GPIF (consumer)

       

      I'm sniffing data on DMA Channel (1), and looping it back into DMA Channel (2).

       

      I need this operation to be as low latency as possible (<200us). I'm using the following method to achieve this:

       

      - Register a callback on the PROD_EVENT notification on the GPIF to USB AUTO-SIGNAL Channel (1), and copy data out of transfer buffer
      - Register a callback on the PROD_EVENT notification on the USB to GPIF MANUAL Channel (2), place data from Channel 1 into transfer buffer and commit buffer.

       

      I'm currently measuring a latency of ~6ms from the initial PROD_EVENT of Channel (1) to the CONS_EVENT of Channel (2)

       

       

      Is this kind of latency expected with a manual DMA channel? What best case latency can we achieve?

      What is the lowest possible latency solution to this (we need to keep data flowing on Channel 2 as normal - only modifying the buffer when we receive data on Channel 1)?

       

       

      Kind regards,

      James

        • 1. Re: FX3 DMA Manual Channel Latency
          Madhu Lakshmipathy

          Hi James,

           

          What you are doing is fine. The latency depends on the size of the buffer from channel 1 that is being copied into channel 2.

           

          To evaluate this, calculate the time when a zero packet buffer is copied. (or just simple skip the code that does the copying and transfer empty buffer). This will give an idea on how much time is utilized in copying.

           

          Regards,

          - Madhu

          • 2. Re: FX3 DMA Manual Channel Latency
            jameswagner

            Hi Madhu,

             

            Can I get an expected latency on the MANUAL DMA Channel?

             

            I want to know the expected time between a PRODUCE EVENT and a CONSUME EVENT. I'm currently measuring around 6ms which is too slow.

             

             

            Regards

            James

            • 3. Re: FX3 DMA Manual Channel Latency
              jameswagner

              Hi Madhu,

               

              I have found that I can get the latency down to around 1ms now.

               

              When I call:  CyU3PDmaChannelGetStatus(&glChHandleSlFifoUtoP, &state, &prodXferCount, &consXferCount);

               

              and calculate the difference: diff = prodXferCount - consXferCount;

               

              Initially the difference is 1 but it increases over time until it reaches 40 where it stabilises. Why is this happening?

               

               

              We would like the PROD EVENT and CONS EVENT to happen as close to eachother as possible (it appears that the CONS EVENT count is lagging by 40)

               

              Warm regards,

              James