7 Replies Latest reply on Jun 17, 2019 8:53 PM by KandlaguntaR_36

    cx3 dma error 47

    ScGr_289066

      Hi All,

       

      I am having one of the most confounding problems.  I have been developing a camera interface using the CX3 and the OV5647 5Mp sensor for many months now.  This have been going well, up to about a week ago.  For some reason, every time I try to transfer video data I am getting DMA commit error 47 (CY_U3P_INVALID_SEQUENCE) when the CX3 calls CyU3PDmaMultiChannelCommitBuffer() in the DMA callback routine.  Up till a week ago, I'd never seen this error.  A multitude of old firmware versions all produce the same error when attempting to stream data to my PC application.  I am able to load and run the demo UVC software and stream data to eCAM using the same hardware, so I know this isn't a hardware issue.

       

      The CX3 firmware is based on https://community.cypress.com/thread/16971?q=Streaming%20RAW%20image%20data%20using%20Cypress%20driver which has been heavily modified for our device.  I've written my own video display app using Microsoft's Visual Studio community 2017 and OpenCV.  Briefly, It is a 64-bit command line app that runs two threads.  The first thread (collection thread) starts streaming then performs continuous XferData calls (using CyAPI.lib) to retrieve camera data into one of four  frame-sized buffers.  A second thread (rendering thread) waits for a complete (filled) frame buffer then translates the Bayer data to an RGB image (OpenCV Mat object) and calls imshow to display the image.  Simple concept.  Logic insures that the buffers are used sequentially and a buffer's content isn't overwritten before it is displayed.

       

      Things have generally been working well aside from the occasional Windows error 31 that terminates collection.

       

      About a week ago while I was experimenting with different imager resolutions and CX3 video/DMA buffer sizes, I lost the ability to send data to my application.  I have many old versions of firmware in various stages of development that I have tried, but they all result in the same invalid sequence error I noted above.  The PC application, at least as far as video data collection is concerned is trivial, a single loop that calls XferData() to move the CX3 data into a DMA buffer sized portion of a video buffer.  The very first call to XferData fails with the sequence error.  No frames/buffers are successful.

       

      At the start of data collection, the PC app, when it was working, would typically report error 995 a few times until the streaming process got started.  Now it reports a single error: 998 (unknown error).  No data is ever transferred.

       

      I added a call to CyU3PDmaMultiChannelGetStatus() before calling CyU3PDmaMultiChannelCommitBuffer() to find the DMA channel status.  It reports CY_U3P_DMA_ACTIVE, which doesn't give much insight into what's happening or why it has changed in the last couple of weeks.  I've tried removing and reinstalling the FX3 development environment in case a DLL or library was corrupted, but even after the reinstall, I'm getting the same behavior.

       

      I'd be very appreciative of anyone who can point me in a direction to hunt down this issue.

       

       

      Thanks,

      Scott

        • 1. Re: cx3 dma error 47
          ScGr_289066

          I just want to mention that I tried the solution posted here (https://community.cypress.com/docs/DOC-10463) and it didn't work.  The code is being invoked (messages are printed), but the commit failure is not resolved.

           

           

          Thanks,

          Scott

          • 2. Re: cx3 dma error 47
            KandlaguntaR_36

            Scott,

             

            It looks like you have changed camera resolution. Hence, the camera started streaming higher data rate than before.

            This error may occur if the host application does not issue IN tokens fast enough to clear the DMA buffers.

             

            Can you please set the camera to basic resolution and try to stream the data?

            • 3. Re: cx3 dma error 47
              ScGr_289066

              Hi,

               

              I have tried all the camera resolutions supported by the camera/firmware: 5Mp, 1080p, 720p and 960p.  They all produce exactly the same result: the first call to XferData fails with error 998 (unknown error) and firmware reports error 47 (invalid sequence).  Further, 1080p's data rate is slower than 5Mp.

               

              At one time, a few weeks ago, all these resolutions worked to some degree or other.  5Mp would sporadically fail with error 31 after running for tens of seconds to many tens of minutes, but would at least present some images.  The other resolutions were quite reliable running for hours without error.

               

              I looked back through the windows 10 update log and see no updates a week or two ago that might explain the change in behavior.  There was an update last Friday with a code update from Cypress that I was hoping would fix the problem.  Alas it didn't.

               

              I am using four buffers each of 25476 bytes (0x6000) and have tried increasing them to 0x6800.  Increasing them beyond this results in an error initializing the DMA buffers.  Even at this larger size, the same errors occur.

               

              Thanks,

              Scott

              • 4. Re: cx3 dma error 47
                ScGr_289066

                What's happening with this?

                • 5. Re: cx3 dma error 47
                  KandlaguntaR_36

                  Scott,

                   

                  It looks like the device is transferring the data from CX3 MIPI to GPIF II; GPIF II to USB but the host is not receiving the data. Hence, the DMA buffers are full. Therefore, you are seeing the 0x47 error.

                  You can check this by placing a counter in Dma_Cons_event.

                   

                  The error 998 is Invalid access to memory location. Looks like there is something wrong with the host application.

                  • 6. Re: cx3 dma error 47
                    ScGr_289066

                    Thanks,

                    The explanation of error 998 was just what I needed to get me back on track.  I had an errant pointer after making the frame buffers dynamic rather than static.  Getting images again.

                     

                    Thanks,

                    Scott

                    • 7. Re: cx3 dma error 47
                      KandlaguntaR_36

                      That's good news!