help on KBA226722 buffer size

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

cross mob
KeWa_2323766
Level 4
Level 4
25 sign-ins First solution authored 25 replies posted

UVC based application for FX3 is created based on the framework of AN75779.  24bit GPIF is used(D23:D0) . image is 800*600.  Pixel depth is 24bit/pixel, i.e. 3Byte/pixel.  Since it is 24bits/pixel raw image, GUID for RGB888 is used for media type and RGB888 will be debayered in host.   DMA buffer keeps the same: 16kB, 4 counts, 2 sockets.  Only change the GPIF bus to 24bits, LD_DATA_COUNT, LD_ADDR_COUNT to 5455. However, it can't stream. 

But according to KBA226722,  

S= 800*600*3= 1,440,000 byte,

F= int(S/(16384-16))= 1440000/16368 = 87

P= fraction of S/(16384-16) * 16368 = 0.976594*16368 = 15984

It should be working. 

I noticed that in KBA226722 , it mentioned in item 5 "If exact line data (i.e nothing is appended at the end of the line data) is intended to be sent to the Host, then make sure that line size in bytes is divisible by GPIF bus width (in bytes)."  I don't quite get this point. 

Help is needed on the proper  setting of DMA configuration and GPIF state machine data and address count value. 

Thanks in advance

 

0 Likes
1 Solution
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Kelly,

Do you see commit buffer failures with VirtualDub and eCamview?

You can also try with MPC-HC player.

Regards,

Hemanth

View solution in original post

0 Likes
16 Replies
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

Counter values look correct for 24-bit GPIF bus width.

Item 5 in KBA226722 means that, you will have to make sure line size in bytes is exactly divisible by GPIF bus width in bytes. If this is not true, then there will be padding of extra bytes at the end of each line.

In your case line size is 800 *3 bytes which is divisible by 3 bytes. So, above condition is satisfied.

Can you please let me know if you have verified using UART debugprints that, for a frame, 87 full DMA buffers and 1 partial buffer is seen?

Regards,

Hemanth
0 Likes
KeWa_2323766
Level 4
Level 4
25 sign-ins First solution authored 25 replies posted

Hemanth,

Thank you for your reply. 

I checked frame completion and buffer commit and found that there is no data received. But, if change buffer size to be 25*1KB = 25kB and change the No. of bytes device can rx in single payload to be 25kB, it will be able to stream video data.  

KeWa_2323766_0-1620224320960.png

 

0 Likes
KeWa_2323766
Level 4
Level 4
25 sign-ins First solution authored 25 replies posted

With 25kB, LD_DATA_COUNT= LD_ADDR_COUNT=8527  is also modified in GPIF state machine

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

Okay. So, with 25kB buffer size, you are able to stream the video. Please confirm if this is correct.

Regards,

Hemanth
0 Likes

Hemanth,

I am able to stream video when using 25kB. But AN75799 says bulk transfer is optimized at 16kB to get max frame rate.  So, I am wondering why 16kB does not work. I am trying to use less memory for video streaming so that other modules can use some without causing problem

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

From the UART logs you shared previously, I see that video streaming is not happening because of commitbuffer failures occurring continuously. 

commitbuffer failures occur when the rate of filling of buffers is greater than the rate at which host empties the same.

So, if you want to try to make streaming work with 16kB buffer size, you can try increasing the total horizontal time on the video parallel interface (that is, you will have to increase horizontal blanking time - which causes decrease in vertical blanking). Also when you do this, make sure that you maintain minimum of ~350us of vertical blanking.

By increasing the total horizontal time, the rate at which DMA buffers get filled decreases.

Regards,

Hemanth
0 Likes
KeWa_2323766
Level 4
Level 4
25 sign-ins First solution authored 25 replies posted

Hermanth,

I increased the horizontal  blanking to the maximum allowed value 1.206us, the vertical blanking is the same which is 450us.  It still does not work for 16kB DMA buffer.   

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

1. Can you please let me know what is your horizontal active time when you increased the blanking to 1.206us?

2. As an experiment, with the same modified blanking value, can you try streaming lesser line size, that is, less than 800px? - For this you need to change the descriptor info as well as the sensor config.

Regards,

Hemanth
0 Likes

Hemanth,

Sorry for the late reply.  The active horizontal time is 11.76us. 

I am modifying the image format to be 640*480 to see whether 16kB will be working.

 

0 Likes

Hemanth,

I changed image frame size to 640*480.  It still does not work with 16kB. It only works with 25kB. i.e, 

in GPIF, LD_DATA_COUNT = =LD_ADDR_COUNT = 8527,

 in UVC.h,  #define CY_FX_EP_BULK_VIDEO_PKTS_COUNT (0x19)      /* 25 packets (burst of 25) per DMA buffer. */

Regards,

 

0 Likes

Hemanth,

I tried another configuration: image frame size: 640*480.  pixel depth: 16bit/pixel.  GPIF data bus : 16 bit ( 8 MSB bits are trimmed off) .  With this configuration, 16kB can stream video to host application Virtual Dub or eCamview .  But, we need stream the video with pixels of its original 24 bits, not only the 16 LSB bits.  Thank you.

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

1. Can you please let me know if the device is operating in USB 2.0 or USB 3.0 mode.

2. From above discussion, I think you are using the following setting for testing. Please confirm.

Hactive:  11.76us Hblanking: 1.206us.

Regards,

Hemanth
0 Likes
KeWa_2323766
Level 4
Level 4
25 sign-ins First solution authored 25 replies posted

Hemanth,

 

The device runs in USB3.0 mode.  I tested  both 16kB and 25kB with Hactive:  11.76us Hblanking: 1.206us when image size set to 800*600. 

Thank you.

Kelly

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Kelly,

Even after increasing the Hblanking to maximum and decreasing the resolution, if you see commit buffer failure, then I think the only way is to increase the DMA buffer size.

Also please try with different video players to see the difference.

Regards,

Hemanth
0 Likes
KeWa_2323766
Level 4
Level 4
25 sign-ins First solution authored 25 replies posted

Hemanth,

I tried VirtualDub and  eCamview.   If you have recommendations  of video player that work differently with these two software,  it would be very helpful.

Thank you.

Kelly

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Kelly,

Do you see commit buffer failures with VirtualDub and eCamview?

You can also try with MPC-HC player.

Regards,

Hemanth
0 Likes