FX3 UVC - black screen in custom board

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
jech_4828421
Level 3
Level 3
50 sign-ins 25 replies posted 25 sign-ins

Hi, 

I made my custom board(FX3 and Camera Module).

I connected it and wrote my custom source code.

The black screen was printed in AMCAP, so I checked the debug message with wireshark.

The Wireshark confirmed that the data was output.

The resolution is 340(W) x 260(H), 30fps and 12bit data output.

You can see data in wireshark log.

  • wireshark log  => ((16380 * 10) + 13292=177,092     
  • resolution  =>  340*260*2 = 176,800
  • difference => 177,092 - 176,800 = 292
  • As above, additional buffers are entered, and it is necessary to check if there is a problem with the code.

I tried to change DMA Buffer size(CY_FX_EP_BULK_VIDEO_PKT_SIZE and CY_FX_EP_BULK_VIDEO_PKTS_COUNT ) in uvc.h

If i change buffer size, the buffers in the data packet are output differently.

Regards,

Jay

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hello Jay,

Please build the attached firmware, program the device and check if it works as expected.

Regards,
Rashi

View solution in original post

31 Replies
lock attach
Attachments are accessible only for community members.
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello Jay,

From the Wireshark traces, it seems that the frame size varies

- 16380*10 + 13292 = 177,092 

- 16380*10 + 13288 = 177,088

The frame size is expected to remain constant.

To check if the frame size received by FX3 is constant please track the producer and consumer events in the firmware using global variable and print the frame info in for {}. Please note it is not recommended to call CyU3PDebugPrint in DMA Callback. Please find the attached firmware with some debug prints to track the DMA buffers, build it with DEBUG_PRINT_FRAME_COUNT enabled and  share the UART debug prints.

From the  GPIF state machine header file, the GPIF bus width is configured as 16 bits as and LD_DATA_COUNT and LD_ADDR_COUNT is 8183 (16384 - 16 /2 ) - 1. These settings are correct if GPIF bus width is 16 bits. Please confirm if any other changes are done to the default AN75779 GPIF state machine

From the descriptors, I understand that the application streams through USB 2.0 (high speed). Please let me know the fps used for your application.

If DMA buffer size is changed, there are other changes needs to be done

- Modify the LD_DATA_COUNT/LD_ADDR_COUNT value in the GPIF state machine

- If the buffer size is increased from 16KB, the RX payload size of the probe control structure also need to be changed. The Rx payload size of probe control should >= DMA buffer size

- the DMA buffer size should be multiple of 16 and (DMA buffer size - 16) should not be multiple of video line size.

Regards,
Rashi
0 Likes

The frame rate is 30 fps. 

The frame size is higher than the set value, is there no solution? Or is there no problem printing the video even if more data is input?

 

0 Likes

Hello,

FX3 is acting a bridge in this application and it just transfers the data received from the sensor after adding 12 bytes UVC header. 

The host application will expect the frame size from the device as described in the USB descriptors and the probe control structure. If the frame size is different then mentioned in the USB descriptors and the probe control structure, the host application will not display the video stream (black screen).

In your case, the frame size is bigger than expected and is also varying. If the default GPIF state machine is used i.e. the only changes done are counter values and GPIF bus width,  then the sensor is giving out bigger frame size. Please check if the sensor is configured correctly and let me know the PCLK value.

Please let me know if the frame size in the UART debug prints is same as seen in the Wireshark traces with firmware I had shared earlier.

As the fps is 30, please modify the bit rate in the USB descriptors as

0x00,0x76,0x87,0x02,/* Min bit rate bits/s */        340*260*16*30
0x00,0x76,0x87,0x02, /* Max bit rate bits/s */      340*260*16*30

The resolution is 340x260, so Do I have to change the height size(260) ?

>> No, for 16 KB buffer the video line size is not multiple of buffer size

(16 *1024 -16 )/340 *2 (16 bits/pixel)

Regards,
Rashi
0 Likes

PCLK is 3.6MHz.

  • Width : active pixel(340), Blank time(60)
  • Height : active pixel(260), Blank time(40)
  • Frame rate : 30fps

I don't have debug cable. so I don't show UART debug prints today.

But, I will get a cable tomorrow.

Can I check it in another way?

0 Likes

Rashi,

I'm making a lot of changes, but it's not being solved well.

The last way is to change to isochronous mode, but it doesn't work well.

Is it possible to change bulk mode to isochronous mode?

I'm sorry, but could you change the code?

Regards,

Jay

0 Likes

Hello Jay,

Please let me know why do you plan to change to isochronous endpoints.

It seems that the data from the sensor received is not proper. In that case please confirm if the sensor outputs correct frame size. To check please share the UART debug prints. If the sensor itself is not sending the frame size as expected changing the endpoints will not help.

Regards,
Rashi
lock attach
Attachments are accessible only for community members.

Hello Rashi,

I upload the UART prints. 

Please check this.

 

Regards,

Jay

0 Likes
lock attach
Attachments are accessible only for community members.

Hello Jay,

Please share the UART debug prints with the attached firmware. I have added more prints for details

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hello Rashi,

Thank you for quick reply.

I upload the UART prints. 

Regards,

Jay

0 Likes

Hello Jay,

As you can see from the debug prints that the FX3 is receiving more bytes than expected from the GPIF  side. The AN75779 GPIF state machine samples the data based on the FV and LV signal status. When FV and LV are high the data on the GPIF lines will be sampled.

Please check the sensor settings it seems that the sensor is giving wrong output.

Please let me know if you can try changing the sensor settings to some other resolution and or configure the higher PCLK (>= 70-80 MHz) with same resolution. With this we can check if the problem is seen only with the current configuration or with different configurations.

Please let me know which sensor is used in your application

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hello Rashi,

I change my sensor configuration. so I upload the log files(wireshark log and UART log).

The sensor settings are as follows,

  • Resolution : 460(W) * 380(H)
  • Frame rate : 30fps
  • PCLK : 9.75MHz

My sensor type is thermal sensor and the output is via ISP chip.

Your question : Please let me know if you can try changing the sensor settings to some other resolution and or configure the higher PCLK (>= 70-80 MHz) with same resolution. 

 ->  It was impossible to change the PCLK at the same resolution, so it was changed to a different PCLK at different resolutions.

Thank you for your response.

Regards,

Jay

0 Likes

Hello Jay,

The logs for the new resolution also shows extra bytes.

It seems that the sensor is sending more  data than expected and the problem seems to be with sensor configuration as the frame size is varying by 160 +/- 4 bytes. This is same for both the resolutions.

Please check the sensor settings, it looks like some extra pixels are sent

The DE (data enable) signal is output from the sensor, is it possible to connect this signal to the GPIF to get an active pixel?

>> Yes, it is possible. For this you would need to modify the GPIF state machine.

Regards,
Rashi
0 Likes

Hello Rashi,

I  tried to modify the GPIF state machine, but I didn't know why state machine didn't work.

I will try to change GPIF designer configuration.

I'm sorry, but could you modify it? 

The signal is as follows.

The GPIF Interface is CLK, LV, FV and DE.

DE signal is connected to GPIO_26.

When data is input, the DE signal is active high.

jech_4828421_0-1615445115908.png

Regards,

Jay

0 Likes

Hello Jay,

Please provide more details on the timing sequence of DE signal along with the FV and LV signals so that I can help you in modifying the GPIF state machine.

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

hello Rashi,

The timing sequence is as follow:

The signal consists of an LCD format. It connect to LCD or Display Device.

so, It contain blank pixels(back porch, front porch), active pixels.

When the DE signal  activate high, active pixels is output.

In other words, the signal can be received when DE is high.

Active pixels is 320 x 240.

jech_4828421_0-1615456595069.png

The current system consists of  the thermal sensor and ISP(image signal processor).

 I attach schematics of the current system.

Regards,

Jay

 

0 Likes

Hello Jay,

I have some queries regarding the timing sequence you shared

- How is the start of frame and end of frame indicated?

- Is it like when VSYNC is low  and DE is high the frame starts and pixel should be sampled?

- How is line start and line stop decided?

From the timing sequence, it is seen that DE is HIGH only when HYSNC and VSYNC are LOW. But at the end of frame the VSYNC is not HIGH (end of frame). So from this timing sequence, it is difficult to understand

Regards,
Rashi
0 Likes

Hello Rashi,

I redrawn a simple timing sequence.

Please check it.

그림1.png

Regards,

Jay

0 Likes
lock attach
Attachments are accessible only for community members.

Hello Jay, 

As per the timing diagram I have modified the GPIF state machine with GPIF bus width as 16 bits.

Please check this and let me know if it works

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hello Rashi,

It didn't work. I upload a log. 

Is it possible to configure the state machine with the second uploaded waveform?

그림2.png

I

그림1.png

another SM.PNG

I tried to configure the state machine attached as the second waveform. Is that right?

Regards,
Rashi

0 Likes

Additional explanation.
Starting with Vsync, Vsync starts 1 frame from active high and Hsync starts 1 row from active high.
When the DE signal is high between Hsync, data is output.

Regards,

Jay

0 Likes

Rashi,

We can change other timing sequence.

그림2.png

Regards,

Jay

0 Likes
lock attach
Attachments are accessible only for community members.

Hello Rashi,

The state machine is configured  with this waveform.

jech_4828421_0-1615775412604.png

The log files are attached with UART and wireshark.

Referring to the log file, packet sizes for 1 frame are being output differently.

  • 1st packet : (16380*8)+5872
  • 2nd packet : (16380*10)+5872
  • (1st packet + 2nd packet)/2 = 153,292
  • Configured resolution : (320*240)*2=153,600

I have two questions.

  1. Why is the packet buffer outputting differently?
  2. Is there a wrong setting among the state machines?

 

Regards,

Jay

0 Likes
lock attach
Attachments are accessible only for community members.

Hello Jay,

In the state machine that you have shared the ADDR nd DATA counter values are 16367.

Please refer to AN75779 application note (page 18), which mentions details on configuring the counter value based on the GPIF bus width

The counter value  = (DMA Buffer size / GPIF bus width) - 1

In you case ADDR and DATA counter values  = (16368 (16 KB - 16) / 2 (16 bits) ) - 1 = 8183

Please checked the attached GPIF State machine with the above change an let me know the results

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hello Rashi,

I checked this.

Referring to the log file, but there is black screen.

 - 16380*9 + 6300 = 153,720

jech_4828421_0-1615785152236.png

 

Please check the log file.

 

Regards,

Jay

0 Likes

Hello Jay, 

If the sensor is configured for 320* 240*2 then the frame size is as expected.

As the stream is not displayed on the host application, please check if the USB descriptors and the probe control structure in the firmware are configured for the same resolution and frame size. 

Also, check if the device is selected to stream the same resolution from the host application.

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hello Rashi,

I check the description setting, but i don't find another setting.

so,  I'm sorry, but can I ask you to check?

Regards,

Jay

0 Likes
lock attach
Attachments are accessible only for community members.

Hello Jay,

Please build the attached firmware, program the device and check if it works as expected.

Regards,
Rashi

Hello Rashi,

The problem has been resolved.
I was able to solve it with your help.

I really appreciate it.

Thank you, Rashi.

 

Regards,

Jay

0 Likes

Hello Jay,

Glad to hear that the problem is resolved!

Regards,
Rashi
0 Likes

I have one more question.
The DE (data enable) signal is output from the sensor, is it possible to connect this signal to the GPIF to get an active pixel?

 

Regards,

Jay

0 Likes

- the DMA buffer size should be multiple of 16 and (DMA buffer size - 16) should not be multiple of video line size.

>>> The resolution is 340x260, so Do I have to change the height size(260) ?

0 Likes