How to split the CX3 frame non-UVC buffering

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.
Sivaraj_A
Level 2
Level 2
5 likes given 10 replies posted 10 questions asked

Hi,

            I want to tranfer the RAW8/RAW10 bit data to Host using Non-UVC Standard. i got the Raw data on Host , But i dont known , how to split the each frame on Streaming Buffer. 

 

Kindly help me, PFA..,

0 Likes
1 Solution

Hello,

Please refer to BulkTranfer API and the parameters passed to the API

https://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection#bulkTransfer(androi...

The "length" parameter decides how much data to request. Please let me know value of length passed to BulkTranfer API and how many times is BulkTranfer called in the host application. If length = 32768 , then 32768 bytes will be read from device when API is executed once (irrespective of size of "buffer")

The "buffer" parameter will just point to the buffer (on Host) for data to be sent or received.

Do we not able to, change the DMA buffer size for Non-UVC? 

>> The DMA buffer size on CX3 can be changed for Non-UVC application also.

Please let me know your requirement as in how much data need to be read from the device

Regards,
Rashi

View solution in original post

10 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

I understand that RAw8/RAW10 frame are received on the USB host (non UVC) without any issues. Is my understanding correct?

Please let me know if how is the data being requested by USB host. Is it possible for you to request one frame of data from USB host ? Also, every frame ends with a  partial DMA buffer if CX3's firmware is used as a base of custom firmware. This could be used to detect the frame end

 

Regards,
Rashi
0 Likes

Hi, 

1. Yes, Raw10 data is received in USB Host. 

2. In USB Host(Android), USB data requested in below snippet 

1. Initially, for Control endpoint request, we are using API - controlTransfer()

var reqType : Int = 0x40 //vendor request

val
result_start = connection?.controlTransfer(
reqType,
0x99, //start streaming
0x0000,
0x0000,
null, //null buffer for data transfer
0,
0) //infinite waiting time

2. To receive the Video streaming data from Bulk-IN Endpoint, we are using API - bulkTransfer()

val bytes_stream = ByteArray(32768) //size
val
result = connection?.bulkTransfer(
endpoint_in, //BULKIN endpoint
bytes_stream, //buffer data
bytes_stream.size,
TIMEOUT //infinite waiting time
)

3. No, I am able to get only 32768 bytes of data per API call. From this I will arrange for single frame after getting full frame data on multiple calls.

4. how to detect the frame end if partial DMA buffer data received? In addition to this analysis, we posted some queries to support with.

 

0 Likes
Sivaraj_A
Level 2
Level 2
5 likes given 10 replies posted 10 questions asked

Hi,

 

We are considering a Frame size is 640*480.

From a buffer size of 512KBytes,

  1. Can we consider the frame data alone of 307 Kbytes.
  2. What will be the remaining bytes in the buffer data? Or can we directly ignore this data?
  3. Does the DMA Buffer size be controllable to get only 307KBytes of data, since in UVC standard, DMA buffer size is controlling from our understanding.
0 Likes

Hello,

Please check point 6 of this KBA Debug UVC application firmware in FX3 – KBA226722 - Infineon Developer Community to understand how the DMA buffers of FX3 will be filled when 640x480 resolution video frame is streamed

I understand that you want to use CX3 with android host. If yes, please refer to this thread  Solved: CX3 -Android - Infineon Developer Community  

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

Hi,

In https://community.infineon.com/t5/Knowledge-Base-Articles/Debug-UVC-application-firmware-in-FX3-KBA2..., we understood clearly how the UVC Frame is getting split. We already done this part.

For Non-UVC, we would like to know few points

  1. In 512 Kbytes of buffer data, 1st  307 Kbytes (640*480) will be frame data. what will be the remaining 205 Kbytes of data. Please find the Log for 512 Kbytes of buffer data(Non-uvc_OV5640_vga.zip).

Or

  1. Does the DMA Buffer size be modified to get only 307KBytes of data.- So, that exactly one frame of data can be received.
0 Likes

Hello,

From the shared document, I understand that 512KB of data is requested by Host. Is my understanding correct?

If yes, than if device is able to send 512KB of data before the timeout happens then 1 full frame and 1 partial frame will be received in 512KB. If the device has less data than requested by host, it will transfer only that much amount of data (short packet). To understand how many frame have been transferred when one USB request is sent by host, please share USB traces using Wireshark.

If host application wants to receive 1 frame data at a time then USB host should request the data equal to frame size (i.e. in this case 640 * 480 * bytes/pixel). Please note that the USB request should also be multiple of USB endpoint packet size. 

Also, please let me know if the changes done in the firmware to support non UVC is similar to this KBA  Modified AN75779 firmware for streaming video usin... - Infineon Developer Community  

Regards,
Rashi

Hi,

1. "From the shared document, I understand that 512KB of data is requested by Host. Is my understanding correct?" - we are following the code from the same link you have provided Modified AN75779 firmware for streaming video usin... - Infineon DeveloperCommunity 

And, the log we shared is taken using "Device Monitoring Studio".  In the log, 524288 bytes transferred during video streaming. we mentioned it as 512 KBytes(524288 bytes). 

2. from Host, using BulkTransfer API from https://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection we could able to request 32768 bytes only, for single call. We could not able to get overall 524288 bytes in single call. From the log, 524288 bytes will be the buffer data. So, we can able to get 524288 bytes. Is our understanding correct? Our frame size is 640*480 -> 307200. 

So, "If yes, than if device is able to send 512KB of data before the timeout happens then 1 full frame and 1 partial frame will be received in 512KB", from this point -
1 frame and partial frame will be received?  Is our understanding correct?

2. Do we not able to,change the DMA buffer size for Non-UVC? 

0 Likes

Hello,

Please refer to BulkTranfer API and the parameters passed to the API

https://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection#bulkTransfer(androi...

The "length" parameter decides how much data to request. Please let me know value of length passed to BulkTranfer API and how many times is BulkTranfer called in the host application. If length = 32768 , then 32768 bytes will be read from device when API is executed once (irrespective of size of "buffer")

The "buffer" parameter will just point to the buffer (on Host) for data to be sent or received.

Do we not able to, change the DMA buffer size for Non-UVC? 

>> The DMA buffer size on CX3 can be changed for Non-UVC application also.

Please let me know your requirement as in how much data need to be read from the device

Regards,
Rashi

Hi @Rashi_Vatsa 

Remainder. Please update us on this we need quick support. 

0 Likes
Sivaraj_A
Level 2
Level 2
5 likes given 10 replies posted 10 questions asked

Or another option we want to do is to get BULK-IN Endpoint data (video stream data) which is UVC-Standard. We found that video stream data was not received using the same API - bulkTransfer() in Android. Thatswhy, we exploring non-UVC mode

0 Likes