1 2 Previous Next 16 Replies Latest reply on Aug 8, 2019 3:34 AM by SrinathS_16

    Help with slave fifo sync source code

    MoLa_3842091

      Thanks Srinath S for your previous reply, I wished to continue discussion but it has been locked,

       

      Referring to our previous discussion help with slavefifo sync source code   I have chosen to use only the DMA ready flags for each thread used in your application omitting the watermark flags and I have implemented it. It worked with me but I still have an issue with the looped back data, it adds 4 bytes of value zero after each 8 bytes.  The following is screen shot from USB Control Center showing the issue that is mentioned. I also attached  verilog file  "slaveFIFO2b_loopback.v" in case you would like to see the changes that I have made, I mainly omitted the watermark flags and updated the "LoopBack mode state machine combo". So what do you think is going wrong?

       

        • 1. Re: Help with slave fifo sync source code
          SrinathS_16

          Hello,

           

          - This looks like the FPGA is not driving the data lines with the data 0xA5. Please probe the lines and check the actual data that is being transmitted. In case, the data seen on the line is 0xA5, the FX3 firmware is not handling the data whereas if the data seen on the line is 0x00, it is because the FPGA is not driving the lines properly. This check would help identify the point of issue.

          - Also, when only the DMA ready flags are used, it has to be noted that there will be delay incurred in propagating the actual state of the thread onto the FLAGx pin.

           

          Best regards,

          Srinath S

          2 of 2 people found this helpful
          • 2. Re: Help with slave fifo sync source code
            MoLa_3842091

            Thanks for your reply,

             

            I tried using Current_Thread_DMA_Ready & Current_Thread_DMA_WaterMark insted of dedicated Full/Empty thread flags (As imentioned previously my hardware can only support two flags), and the result was as follows:

            I was able to get correct loop-back data but not from the first trial, this is the scenario to get correct loop-back back

            1)In USB Control Center I select Bulk out endpoint (0x01) and I have to send file size (512) twice successfully, and the third time I send i get

            BULK OUT transfer

            BULK OUT transfer failed with Error Code:997

             

            2)Then I select Bulk in endpoint (0x81) and I click on "Transfer Data-IN" button to receive (512) data size that I have sent previously, and this what happens

                 a)First time I receive data successfully but data is not the same data that i have sent in the Bulk out endpoint (0x01).

                 b)I click again on the "Transfer Data-IN" button for the second time, third and fourth time and the result is the same as the first trial.

                 c)The Fifth time I receive exactly correct data "the data that I have sent during Bulk out".

                  d)The sixth time I get :

                 BULK IN transfer

                 BULK IN transfer failed with Error Code:997

             

            Why do you think it's working this way?! Does it have to do with the capabilities of "USB Control Center" or it's all about the FIFO. I would appreciate getting justification for this behavior.

             

            Thank you for your time and further coming response

            • 3. Re: Help with slave fifo sync source code
              MoLa_3842091

              Thanks for your reply,

               

              I tried using Current_Thread_DMA_Ready & Current_Thread_DMA_WaterMark insted of dedicated Full/Empty thread flags (As imentioned previously my hardware can only support two flags), and the result was as follows:

              I was able to get correct loop-back data but not from the first trial, this is the scenario to get correct loop-back back

              1)In USB Control Center I select Bulk out endpoint (0x01) and I have to send file size (512) twice successfully, and the third time I send i get

              BULK OUT transfer

              BULK OUT transfer failed with Error Code:997

               

              2)Then I select Bulk in endpoint (0x81) and I click on "Transfer Data-IN" button to receive (512) data size that I have sent previously, and this what happens

                   a)First time I receive data successfully but data is not the same data that i have sent in the Bulk out endpoint (0x01).

                   b)I click again on the "Transfer Data-IN" button for the second time, third and fourth time and the result is the same as the first trial.

                   c)The Fifth time I receive exactly correct data "the data that I have sent during Bulk out".

                    d)The sixth time I get :

                   BULK IN transfer

                   BULK IN transfer failed with Error Code:997

               

              Why do you think it's working this way?! Does it have to do with the capabilities of "USB Control Center" or it's all about the FIFO. I would appreciate getting justification for this behavior.

               

              Thank you for your time and further coming response

              • 4. Re: Help with slave fifo sync source code
                SrinathS_16

                Hello,

                 

                - Please ensure that the DMA channel buffers are cleared before being used in the firmware.

                - Use debug statements in the PROD_EVENT handler in the firmware to know the number of times the PROD_EVENT is being called.

                - Kindly, share the firmware that you are using to test.

                - If possible, capture the waveform of the SLWR and PCLK lines.

                 

                Best regards,

                Srinath S

                • 5. Re: Help with slave fifo sync source code
                  MoLa_3842091

                  Hi

                  -> Please ensure that the DMA channel buffers are cleared before being used in the firmware.

                  How can I ensure that the DMA channel buffers are cleared before using the firmware?

                   

                  ->Use debug statements in the PROD_EVENT handler in the firmware to know the number of times the PROD_EVENT is being called.

                  -initially it seems that PROD_EVENT has been called once from P to U without I send/receive data!! (glDMATxCount = 1).

                  -PROD_EVENT is called 2 times from U to P when I transfer 512 file twice via (Bulk Out 0x01) (glDMARxCount = 2) & (glDMATxCount = 2).

                  -The first time I receive data via (Bulk In 0x81), (glDMATxCount = 3), this means that  PROD_EVENT from P to U is called 2 times before I really call it.

                  Is that normal?

                   

                  -> Kindly, share the firmware that you are using to test.

                  -The firmware I'm using is exactly the same as the "SlaveFifoSync" source code project, the only change I did was in the gpif designer (I replaced 4 dedicated flags (A,B,C,D) to 2 Current flags (A,B).

                   

                  -> If possible, capture the waveform of the SLWR and PCLK lines.

                  - I'll try to do that

                   

                   

                  • 6. Re: Help with slave fifo sync source code
                    SrinathS_16

                    Hello,

                     

                    -initially it seems that PROD_EVENT has been called once from P to U without I send/receive data!! (glDMATxCount = 1).

                    -PROD_EVENT is called 2 times from U to P when I transfer 512 file twice via (Bulk Out 0x01)(glDMARxCount = 2) & (glDMATxCount = 2).

                    -The first time I receive data via (Bulk In 0x81), (glDMATxCount = 3), this means that  PROD_EVENT from P to U is called 2 times before I really call it.

                    Is that normal?

                     

                    --> Each time PROD_EVENT occurs on the P to U channel, it indicates that a new buffer has been filled and is ready to be committed to the USB host. Since you have mentioned that the PROD_EVENT is called 3 times (glDMATxCount = 3), it indicates that three buffers of FX3 DMA has been filled with data from FPGA. The buffers in FX3 gets filled from the P-Port interface whenever there is PCLK and SLWR assertion. The FPGA needs to assert the SLWR pin only when the data needs to be transmitted to the FX3 buffers. Kindly, check this.

                     

                    Best regards,

                    Srinath S

                    1 of 1 people found this helpful
                    • 7. Re: Help with slave fifo sync source code
                      MoLa_3842091

                      Thanks Srinath S for your reply, your reply helped me analyz and debug,

                       

                      I made sure that I check the behavior of the signals as soon as the as firmware is downloaded and this what I found at the most beginning:

                      1- I downloaded FPGA firmware

                      2- Activated signal tap on (reset_in_, flaga, clk, slcs, sloe, slrd, slwr)

                      3- Downloaded fx3 firmware

                      And this what happens:

                      a- reset_in_ is de-asserted

                      b- after  2 cycles from reset_in_ de-assertion, sloe and slrd are asserted by the FPGA

                      c- And after one cycle of sloe and slrd has been asserted, flaga is asserted by fx3 (Indicating slave fifo buffer is full) although I haven't yet transferred any data via Bulk out endpoint. And I also get this debug messege [CYU3P_PIB_ERR_THR3_RD_UNDERRUN] indicating flag violation causing the FPGA to perform read operation while slave fifo buffer is empty.

                       

                      Q1: How do you think I shold  solve this issue?

                       

                      Thank you for your time

                      • 10. Re: Help with slave fifo sync source code
                        SrinathS_16

                        Hello,

                         

                        When you mention that the FLAGA is asserted, what is the thread that is selected by the A[1:0] lines. Since FLAGA indicates the current thread's ready condition, it also depends on the address lines selecting the active thread.

                         

                        Best regards,

                        Srinath S

                        • 11. Re: Help with slave fifo sync source code
                          MoLa_3842091

                          Hi

                          This is  a screen shot of signal tap, I hope it's clear enough

                           

                          DataAquasition.jpg

                          • 12. Re: Help with slave fifo sync source code
                            SrinathS_16

                            Hello,

                             

                            - Please let me know why FPGA asserts the SLRD/SLOE lines when the FLAGA is not asserted? FLAGA is the Current_Thread_DMA_Ready Flag which indicates whether the active thread's socket is ready with data or not. The assertion of this flag needs to be checked before asserting the SLOE/SLRD signals. This is the reason for the RD_UNDERRUN error.

                            - Also, let me know what are the flaga_d and flagb_d signals.

                             

                            Best regards,

                            Srinath S

                            • 13. Re: Help with slave fifo sync source code
                              MoLa_3842091

                              Hi,

                               

                              ->Please let me know why FPGA asserts the SLRD/SLOE lines when the FLAGA is not asserted? FLAGA is the Current_Thread_DMA_Ready Flag which indicates whether the active thread's socket is ready with data or not. The assertion of this flag needs to be checked before asserting the SLOE/SLRD signals. This is the reason for the RD_UNDERRUN error.

                              I'm not sure why it gets asserted, I'll revise the FPGA firmware. In GPIF designer > Flag settings > Initial value : Low And Polarity is active low. Do you think this could affect the FPGA functionality? I tried all other settings but it didn't work.

                               

                              -> Also, let me know what are the flaga_d and flagb_d signals.

                              flaga_d and flagb_d are the registers in FPGA that stores the value of flaga and flagb. Initially when resetting the device, value in these registers is "0" but then it immediately takes the value of flaga and flagb from the hardware coming from fx3.

                              • 14. Re: Help with slave fifo sync source code
                                SrinathS_16

                                Hello,

                                 

                                FX3 flags can be set with any polarity and any initial value. The FPGA code needs to be set accordingly to sample these flags and drive the other signals appropriately.

                                 

                                Best regards,

                                Srinath S

                                1 2 Previous Next