Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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.
Rustam
Level 1
Level 1
5 replies posted First reply posted First question asked

 

Hello experts!
 
I'm trying to build a USB-UVC camera using the CYUSB3065-BZXC ICS and IMX477 sensor like this post:
 
I created a project template from Cypress EZ USB Suite using CX3 Configuration Tool v2.0 (SDK 1_3_5).
I have added some camera profiles for USB2.0 and USB3.0 modes (see cx3config.zip) and am adding I2C registers for my sensor. Project compiles successfully. The app starts good(if I'm not wrong).
 
Then I conncet CX3 with sensor to linux PC (Debian GNU/Linux 11 (bullseye), i see:
~$ v4l2-ctl --list-devices
CX3-UVC (usb-xhci-hcd.8.auto-1):
/dev/video0
/dev/video1
/dev/media0
 
~$ v4l2-ctl --list-formats-ext --device=/dev/video0
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'YUYV' (YUYV 4:2:2)
Size: Discrete 4056x3040
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.040s (25.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.040s (25.000 fps)
 
1) then I select 640x480 RAW12:
v4l2-ctl --set-fmt-video=width=640,height=480,pixelformat=YUYV
And try to capturing i see next CX3 log data: CX3_log_mode_1.zip
In this mode I can grub frames from V4l2 driver.
 
2) then I select 1280x720 RAW12:
v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=YUYV
And try to capturing I can't receive frames from V4l2 driver, and Frm_Sz in CX3 log not fixed
See CX3_log_mode_2.zip
 
3) then I select 4056x3040 RAW12:
v4l2-ctl --set-fmt-video=width=4056,height=3040,pixelformat=YUYV
Same behavior, see CX3_log_mode_3.zip
 
I have next questions:
1) What could be the problem with cases 2 and 3?
2) Why does the frame rate measured by CX3 differ from the one specified in the profile?
3) Whats differs between GPIF Parrallel data widh mode: "16-bit Zero Pad" and "16-bit Pack"?
   My current setup based on "16-bit Zero Pad" option in data log for captured frames (RAW12 640x480 case) I see: 
   0xD3 0x02 0x40 0x03 0xEE 0x02 0x2B 0x03 ... (614400 bytes total):
           0xD3 is [11:4] bits of 1st pixel
           0x02 is [11:4] bits of 2nd pixel
           0x40 -> 0x40 are [3:0] bits of 1st pixel and 0x00 are [3:0] bits of 2st pixel
           0x03 is trash?
           etc...
          2 bytes per pixel - > 640x480*2 = 614400 bytes (Frame)
Is it correct?
   
P.S. Sorry if it noobs questions.
0 Likes
1 Solution
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi,

CX3 can be configured to pack or pad the data from the image sensor. For example let us consider the example of packing and padding the incoming video frame of 1920 x 1080 in RAW10 format into 16 bits. 

1. When CX3 is configured to pad the incoming data into 16 bits, it pads 6 additional bits to each pixel and makes each pixel of 16 bits.

So, input frame size from the sensor will be 1920 x 1080 x 10 bits

Output from CX3 will be 1920 x 1080 x 16 bits. The same will be printed in the UART debug logs as frame size.

2. When CX3 is configured to pack the incoming data into 16 bits, it does not add any additional data to the data received from image sensor. It just packs the incoming data into 16 bits. The way CX3 packs the incoming RAW10 data from the image sensor is already mentioned in the following KBA:

https://community.infineon.com/t5/Knowledge-Base-Articles/Streaming-RAW10-Format-Input-Data-to-16-24...

So, here the input frame size from the image sensor will be 1920 x 1080 x 10 bits

The frame size of the data that you will see is the one actually received by CX3 (after padding or packing). It is also equal to the size of the data transmitted over the USB interface excluding the UVC header added to each DMA buffer.

Kindly let us know how are you changing the H blanking and V blanking and for which values are you getting the proper frames?

Regards,

Mallika

View solution in original post

0 Likes
7 Replies
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi,

Did you try cases (2) and (3) in Windows?

If no, can you please check and let us know if the issue persists.

Regards,

Mallika

0 Likes
Rustam
Level 1
Level 1
5 replies posted First reply posted First question asked

Yes, I tried all three cases on Windows, the behavior is the same. Maybe the CX3 configuration is wrong? I'm confused by the Frm_Sz variable and the frame rate being different from the set value. Using wireshark, I can see that the packets are reaching the host.

0 Likes
Rustam
Level 1
Level 1
5 replies posted First reply posted First question asked

I am sorry,  аre there any updates?

0 Likes
Rustam
Level 1
Level 1
5 replies posted First reply posted First question asked

I tried to change H-Blanking and V-blanking and for some values I have correct and stable Frm_Sz. In this mode, Linux and Windows collect frames. For example, for resolution 1 I found the following profile:

Rustam_0-1710138363158.pngRustam_1-1710138391734.png

The frame is assembled correctly, but there are artifacts in the image (line shift). This artifact is not present on other resolutions.

Rustam_2-1710139331588.png

 

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi,

CX3 can be configured to pack or pad the data from the image sensor. For example let us consider the example of packing and padding the incoming video frame of 1920 x 1080 in RAW10 format into 16 bits. 

1. When CX3 is configured to pad the incoming data into 16 bits, it pads 6 additional bits to each pixel and makes each pixel of 16 bits.

So, input frame size from the sensor will be 1920 x 1080 x 10 bits

Output from CX3 will be 1920 x 1080 x 16 bits. The same will be printed in the UART debug logs as frame size.

2. When CX3 is configured to pack the incoming data into 16 bits, it does not add any additional data to the data received from image sensor. It just packs the incoming data into 16 bits. The way CX3 packs the incoming RAW10 data from the image sensor is already mentioned in the following KBA:

https://community.infineon.com/t5/Knowledge-Base-Articles/Streaming-RAW10-Format-Input-Data-to-16-24...

So, here the input frame size from the image sensor will be 1920 x 1080 x 10 bits

The frame size of the data that you will see is the one actually received by CX3 (after padding or packing). It is also equal to the size of the data transmitted over the USB interface excluding the UVC header added to each DMA buffer.

Kindly let us know how are you changing the H blanking and V blanking and for which values are you getting the proper frames?

Regards,

Mallika

0 Likes
lock attach
Attachments are accessible only for community members.
Rustam
Level 1
Level 1
5 replies posted First reply posted First question asked

Thank's for the clarification. I am attaching the settings at which v4l2 collects a frame from CX3 (). 
The frame sizes output from CX3 match the expected W*H*2 bytes.
The artifact in the form of a band in 12 Mpix mode went away when I lowered the CSI frequency to 300 MHz.

Now two things confuse me:
1) Stripes appear randomly on images (at any resolution):

Rustam_0-1711092885291.png

2) Something is not clear with the contents of the frame:
for white color I see data starting (the same for RAW10 and RAW12) with FF 0F FF 0F FF 0F FF ...
If I understand you correctly it should be: 0F FF 0F FF 0F FF 0F ...
Now in processing I do this:

Rustam_1-1711092948621.png

I am attaching a Python script that I use to receive data from CX3 (CX3_raw_on_uvc.py)

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi,

Kindly let us know the following details:

>> Please check if you have any PIB errors and share the UART debug logs.

>> Kindly let us know the DMA configuration that you are using.

>> Kindly share the frame resolution, format, pixel depth and FPS as well.

Regards,   

Mallika                         

 

0 Likes