Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

TeLe_4638221
New Contributor

I have changed the firmware provided AN75779 to meet the requirement with the follow features :

1. 32-bit synchronous parallel data interface

2. 16 bits per pixel

3. YUY2 color space

4. 3264*2448 pixel resolution

5. 16 frames per second

6. Active high frame, line valid signals.

I don't know why streaming is not working.

I hope someone could help me, thank you.

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator

Hello Ted Lee,

In the firmware you shared, i found that the buffer size you mentioned in incorrect

1) Set CY_FX_UVC_STREAM_BUF_SIZE  (0x8000) // 32 KB instead of (0x8000 + 16)

Also changes need to be done in probe control setting This field should be set to more than or equal to the DMA buffer size

0x00, 0x40, 0x00, 0x00,     /* No. of bytes device can rx in single payload = 16 KB */ // This is when DMA buffer size is 16KB

2) Set this field to   0x00, 0x90, 0x00, 0x00,     /* No. of bytes device can rx in single payload = 36 KB */ As the DMA Buffer size id 32 KB

Please modify the firmware with above mentioned settings and try streaming. Please let me know the results

Regards,

Rashi

Regards,
Rashi

View solution in original post

0 Likes
14 Replies
Rashi_Vatsa
Moderator
Moderator

Hello,

- Please confirm that the sensor is configured correctly. Please probe the FV, LV, PCLK signals from the sensor and share the traces.

- Also share the debug prints after programming FX3

- The probe control settings and descriptors, in the firmware files you shared, seems fine.

- Is the FX3 device enumerating as UVC (under Camera section of device manager)

Regards,

Rashi

Regards,
Rashi
0 Likes
TeLe_4638221
New Contributor

Hello, Rashi

please check the answers like below,,

1. Please confirm that the sensor is configured correctly. Please probe the FV, LV, PCLK signals from the sensor and share the traces.

- Actually I have not used the sensor, but FPGA make frame data by pattern generation automatically. (using VIP Lattice board)

2. Also share the debug prints after programming FX3

- please check upload image file(1.jpg)

3. The probe control settings and descriptors, in the firmware files you shared, seems fine.

4. Is the FX3 device enumerating as UVC (under Camera section of device manager)

- please check upload image file(2.jpg)

Thanks for your reply.

Best Regards,

TaeYoung Lee

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Ted,

From the debug prints you shared it seems that there are no PROD events (dma callback). There can be a possibility that the data is not coming from the FPGA (data generator).

The FPGA data generator should provide the FV , LV and PCLK to FX3. Please probe the lines and share the traces.

- Also from the debug prints, there are commit buffer failure. Please check the return status of the CyU3PDmaMultiChannelCommitBuffer of this API and let me know the return status. Please refer to this KBA if the error code is 71 Invalid Sequence Error in Multi-Channel Commit Buffer - KBA218830

Regards,

Rashi

Regards,
Rashi
0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Ted,

Adding to my previous response.

Please let me know the PCLK frequency.

You can set the system clock to 403.2 MHz by settings clkCfg.setSysClk400 = CyTrue; as in the default firmware it is set to 384 MHz

        clkCfg.setSysClk400 = CyTrue;   /* FX3 device's master clock is set to a frequency > 400 MHz */

        clkCfg.cpuClkDiv = 2;           /* CPU clock divider */

        clkCfg.dmaClkDiv = 2;           /* DMA clock divider */

        clkCfg.mmioClkDiv = 2;          /* MMIO clock divider */

        clkCfg.useStandbyClk = CyFalse; /* device has no 32KHz clock supplied */

        clkCfg.clkSrc = CY_U3P_SYS_CLK; /* Clock source for a peripheral block  */

    /* Initialize the device */

    status = CyU3PDeviceInit (&clkCfg);

    if (status != CY_U3P_SUCCESS)

    {

        goto handle_fatal_error;

    }

Regards,

Rashi

Regards,
Rashi
0 Likes
TeLe_4638221
New Contributor

Hello, Rashi

First of all, PCLK is 81~82 Mhz.

And I probed FV, LV, PCLK pin. please refer to the image files.

0 Likes
TeLe_4638221
New Contributor

and add some log files.log.jpg

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

From the FV, LV traces, it seems the data is coming as expected.

The debug prints show that there is commit buffer failure.

Can you just check the return value of  CyU3PDmaMultiChannelCommitBuffer API

status = CyU3PDmaMultiChannelCommitBuffer (chHandle, (dmaBuffer.count + CY_FX_UVC_MAX_HEADER), 0);

            if (status == CY_U3P_SUCCESS)

            {

#ifdef DEBUG_PRINT_FRAME_COUNT

                glDmaDone++;

#endif

            }

            else

            {

                   var = status;      // declare a global variable "var"

                if(glDmaResetFlag == CY_FX_UVC_DMA_RESET_EVENT_NOT_ACTIVE)

                {

                    glDmaResetFlag = CY_FX_UVC_DMA_RESET_COMMIT_BUFFER_FAILURE;

                    CyU3PEventSet(&glFxUVCEvent, CY_FX_UVC_DMA_RESET_EVENT, CYU3P_EVENT_OR);

                }

                break;

            }

Get this var value printed in the event handler:

if (((flag & CY_FX_UVC_DMA_RESET_EVENT) != 0) && glIsApplnActive)

            {

                if(glDmaResetFlag == CY_FX_UVC_DMA_RESET_COMMIT_BUFFER_FAILURE)

                    CyU3PDebugPrint (4, "DMA Reset Event: Commit buffer failure = %d \r\n", var);

After these modification in the firmware, please share the debug prints

- You can also try increasing DMA buffer size to 32 KB and DMA buffer count to 3

- Please let me know which host application are you using for displaying video stream

Regards,

Rashi

Regards,
Rashi
0 Likes
TeLe_4638221
New Contributor

hello,

I increase DMA buffer size to 32KB and DMA buffer count to 3.

So " DMA Reset Event: Commit buffer failure" error is gone.

but, my Host Application was not working. I don't know why it appeared the black screen ( I used Amcap )

I guessed that it didn't transfer data from FX3 to USB or Host Application could not receive that.

Please check the Image files that I included.

Thanks for your help.

Following your guide, eventually it is getting better that the problem is solved

Best Regards,

Ted Lee

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Ted Lee,

Please confirm that you have enabled the desired resolution in AMCap i.e. 3264*2448

amcap.PNG

If the desired resolution is set in the properties above and still there is black screen, please probe the USB lines using wireshark analyzer and share the traces

Regards,

Rashi

Regards,
Rashi
0 Likes
TeLe_4638221
New Contributor

hello,

Maybe AMcap is possible to stream the video by 3264*2448 resolution.

(also, I have used GraphEditPlus application for UVC format)

I didn't used to analyze output log by Wireshark.

I just guessed that some data was send to Host.

please confirm the image files that I got the output log by Wireshark.

and if you let me know your e-mail, I send you Wireshark data file

.pcapng file size is so big about 2 GByte.

Thank you for your help

Best Regards,

Ted Lee.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Ted Lee,

Maybe AMcap is possible to stream the video by 3264*2448 resolution.

>> I didn't understand. Why cannot you use this resolution in AmCap

From the wireshark logs,  it is seen that the frame data is not uniform. Every alternate frame it is 16411 (16384 + 27 (wireshark header)) and 16407 (16380 +27 (wireshark header)

The data that is expected to receive on host side for DMA buffer size of 16 KB is 16380 bytes i.e. 16368 +12( UVC header) but instead sometimes it is 16384 bytes (i.e 16372 + 12 (UVC header))

From this it seems that data from FPGA is not uniform for every frame.. For every frame there should be (3264*2448 *2)/16368 = 976 (full buffers) and 1 partial buffer. Please confirm that the data coming for every frame by counting the PROD events for one frame. As the frame end is detected by partial buffer increment a variable to count the PROD events till partial buffer is committed. This is done in the default firmware by enabling DEBUG_PRINT_FRAME_COUNT macro. So , if the macro is enabled and debug prints show that the buffers (buffer count i.e 977) for every are frame is not same, there is some problem on the FPGA (video generator side).

Regards,

Rashi

Regards,
Rashi
0 Likes
TeLe_4638221
New Contributor

Hello,

Thanks for your reply.

Maybe AMcap is possible to stream the video by 3264*2448 resolution.

>> I didn't understand. Why cannot you use this resolution in AmCap

>> Please make sure what you mean. I understand that Amcap is possible to stream any resolution like HD, FHD, customized resolution(2000x1200, 3264x2448 etc.)

so, I got some Wireshark packet data. I tested below:

1. FX3 - 2200 x 1200 resolution - success

2. FX3 - 3264 x 2448 resolution - fail

3. CX3 - 3264 x 2448 resolution - success

At this point, I came up with some question.

FX3 transfer seperated data( 16411 & 16407 ) when the source code is set by 3264 x 2448 resolution because DMA buffer is increased

but according to CX3 differently FX3, it transfer data (36855 bytes at one time)

please refer the Image files that I uploaded.

Questions

- how can I modify source for sending data fully ? (like CX3, 36855 bytes)

- how can I set Header & Footer?

please let me know if it doesn't explain enough.

thanks you for your help

Best Regard,

TaeYoung Lee.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Ted Lee,

In the firmware you shared, i found that the buffer size you mentioned in incorrect

1) Set CY_FX_UVC_STREAM_BUF_SIZE  (0x8000) // 32 KB instead of (0x8000 + 16)

Also changes need to be done in probe control setting This field should be set to more than or equal to the DMA buffer size

0x00, 0x40, 0x00, 0x00,     /* No. of bytes device can rx in single payload = 16 KB */ // This is when DMA buffer size is 16KB

2) Set this field to   0x00, 0x90, 0x00, 0x00,     /* No. of bytes device can rx in single payload = 36 KB */ As the DMA Buffer size id 32 KB

Please modify the firmware with above mentioned settings and try streaming. Please let me know the results

Regards,

Rashi

Regards,
Rashi

View solution in original post

0 Likes
TeLe_4638221
New Contributor

Hello RashiV.

Follow your guide, I solved the problems.

I appreciated about your help. 

Best Regards,

Ted Lee.

0 Likes