CyCx3UvcAppUSBEventCB never executed

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

cross mob
MaSt_4567191
Level 4
Level 4
10 likes given 5 likes given First like received

as per subject, the event is registered by

    CyU3PUsbRegisterEventCallback(CyCx3UvcAppUSBEventCB);

but never executed. AFIK this means no USB event is triggerered by the system so the various booleans like glMipiActive, glIsConfigured, glIsStreamingStarted etc. are left to false ...

I connected a MIPI stream to the CX3 inputs (the connection is a bit noisy since I bypassed an FPGA which merges two sensors into one) just to check the USB

Can you address a way ti debug this? I guess the MIPI peripheral deliver some interrupt to the CPU as soon as a valid stream is detected right?

Thanks much

0 Likes
1 Solution

Hello Marco,

Please make use of the following code snippet for implementing device reset using the API CyU3PDeviceReset(CyFalse); inside the event callback.

pastedImage_0.png

After programming denebola kit with the .img file, please open the host application and start streaming. If you see that the device is reset, that is, it enumerates as a bootloader device in control center, then the callback is triggered. Otherwise, it is not triggered.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

45 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello Marco,

CyU3PUsbRegisterEventCallback() function registers a USB event callback function with the USB driver.  So, whenever a USB event of interest happens, the callback function CyCx3UvcAppUSBEventCB will be invoked. Inside the callback function, the event that triggered the callback is identified.

Please let me know how did you confirm that CyCx3UvcAppUSBEventCB is not triggered.

You can make use of the API CyU3PDeviceReset(CyFalse); inside the callback function (CyCx3UvcAppUSBEventCB) to check whether the callback was triggered or not. If the callback was triggered, then the device will enumerate as Bootloader Device in Control Center. This can be used to check whether the callback function was triggered or not.

Please let me know if your application is UVC compliant or not. If it is UVC compliant, which host application are you using for streaming the video.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

Hello jayakrishna

>Please let me know how did you confirm that

> CyCx3UvcAppUSBEventCB is not triggered.

I just put a breakpoint at the CyCx3UvcAppUSBEventCB but the execution never break

> You can make use of the API CyU3PDeviceReset(CyFalse); inside the callback function

> (CyCx3UvcAppUSBEventCB) to check whether the callback was triggered or not

How? Just call it from inside CyCx3UvcAppUSBEventCB

> Please let me know if your application is UVC compliant or not. If it is UVC compliant,

Supposedly yes

> which host application are you using for streaming the video.

VLC player (this works with Denebola board with the default (Capture Mode: DirectSHow, Video Decice Name: CX3-UVC which enumaerates correctly)

0 Likes

Hello Marco,

Please make use of the following code snippet for implementing device reset using the API CyU3PDeviceReset(CyFalse); inside the event callback.

pastedImage_0.png

After programming denebola kit with the .img file, please open the host application and start streaming. If you see that the device is reset, that is, it enumerates as a bootloader device in control center, then the callback is triggered. Otherwise, it is not triggered.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

Thanks, Got it

I confirm that my system does not move to boot mode i.e. I cannot see it in the USB control center

0 Likes

Sorry , it is (I forgot to save the c file … sorry)

I can see the boot manager enumareted in the USB control

0 Likes

Hello,

Now you can copy and paste the CyU3PDeviceReset(CyFalse); statement into different cases within the callback function. While doing so, use the API only for one event at a time. This can be used to  check which event triggered the callback. Note that when you do this, the initial CyU3PDeviceReset(CyFalse); need to be removed or commented out to prevent unnecessary resets.

Best Regards,

Jayakrishna

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

OK, after a painful and frustrating trial-and-error blind process I can see some activity on the DMA. The key action was to have VLC media player open *before* I make my application in execution. This may be  due my ignorance about how video over USB and UVC behaves ...

I still cannot see video on VLC, though (Your input can't be opened: VLC is unable to open the MRL 'dshow://'. Check the log for details.😞 any idea to address me on the proper way?

I attached the configuration file for you to check if UVC can be unpleased by some settings ...

This is the log: first the bRType change according to

bRType = 0x81, bRequest = 0x0, wValue = 0x0, wIndex = 0x0, wLength= 0x2

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

AppInit:GpifSMStart passed

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

Then the application start-stop and the printflag active Frame informations

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Prod = 13 Cons = 13  Prtl_Sz = 30832 Frm_Cnt = 407 Frm_Sz = 509440 B

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Prod = 33 Cons = 33  Prtl_Sz = 18992 Frm_Cnt = 408 Frm_Sz = 1233920 B

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Prod = 14 Cons = 14  Prtl_Sz = 7792 Frm_Cnt = 409 Frm_Sz = 523216 B

Prod = 14 Cons = 14  Prtl_Sz = 34976 Frm_Cnt = 410 Frm_Sz = 550400 B

Prod = 36 Cons = 36  Prtl_Sz = 26304 Frm_Cnt = 411 Frm_Sz = 1351680 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 54 Cons = 54  Prtl_Sz = 16416 Frm_Cnt = 412 Frm_Sz = 2004480 B

Prod = 64 Cons = 64  Prtl_Sz = 12772 Frm_Cnt = 413 Frm_Sz = 2368996 B

Prod = 75 Cons = 74  Prtl_Sz = 6160 Frm_Cnt = 414 Frm_Sz = 2767360 B

Prod = 56 Cons = 55  Prtl_Sz = 6784 Frm_Cnt = 415 Frm_Sz = 2068480 B

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Prod = 68 Cons = 67  Prtl_Sz = 1168 Frm_Cnt = 416 Frm_Sz = 2504656 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 80 Cons = 80  Prtl_Sz = 14080 Frm_Cnt = 417 Frm_Sz = 2959360 B

Prod = 39 Cons = 38  Prtl_Sz = 336 Frm_Cnt = 418 Frm_Sz = 1436160 B

Prod = 50 Cons = 50  Prtl_Sz = 12640 Frm_Cnt = 419 Frm_Sz = 1853440 B

Prod = 43 Cons = 43  Prtl_Sz = 19472 Frm_Cnt = 420 Frm_Sz = 1602560 B

TimeDiff = 13792 ms FPS = 2

Prod = 16 Cons = 16  Prtl_Sz = 33024 Frm_Cnt = 421 Frm_Sz = 622080 B

Prod = 75 Cons = 74  Prtl_Sz = 6160 Frm_Cnt = 422 Frm_Sz = 2767360 B

Prod = 63 Cons = 63  Prtl_Sz = 33232 Frm_Cnt = 423 Frm_Sz = 2352640 B

Prod = 55 Cons = 55  Prtl_Sz = 15440 Frm_Cnt = 424 Frm_Sz = 2040320 B

Prod = 19 Cons = 19  Prtl_Sz = 32656 Frm_Cnt = 425 Frm_Sz = 732160 B

Prod = 33 Cons = 33  Prtl_Sz = 26672 Frm_Cnt = 426 Frm_Sz = 1241600 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 30 Cons = 30  Prtl_Sz = 11680 Frm_Cnt = 427 Frm_Sz = 1116160 B

Prod = 41 Cons = 41  Prtl_Sz = 21424 Frm_Cnt = 428 Frm_Sz = 1530880 B

Prod = 103 Cons = 103  Prtl_Sz = 9552 Frm_Cnt = 429 Frm_Sz = 3801600 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 16 Cons = 16  Prtl_Sz = 33024 Frm_Cnt = 430 Frm_Sz = 622080 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 90 Cons = 90  Prtl_Sz = 29920 Frm_Cnt = 431 Frm_Sz = 3343360 B

Prod = 74 Cons = 74  Prtl_Sz = 35296 Frm_Cnt = 432 Frm_Sz = 2759680 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 68 Cons = 68  Prtl_Sz = 2752 Frm_Cnt = 433 Frm_Sz = 2506240 B

Prod = 89 Cons = 89  Prtl_Sz = 10416 Frm_Cnt = 434 Frm_Sz = 3287040 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 58 Cons = 58  Prtl_Sz = 17632 Frm_Cnt = 435 Frm_Sz = 2152960 B

Prod = 68 Cons = 68  Prtl_Sz = 7872 Frm_Cnt = 436 Frm_Sz = 2511360 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Prod = 60 Cons = 60  Prtl_Sz = 10560 Frm_Cnt = 437 Frm_Sz = 2219520 B

Prod = 64 Cons = 64  Prtl_Sz = 29696 Frm_Cnt = 438 Frm_Sz = 2385920 B

Prod = 75 Cons = 74  Prtl_Sz = 1040 Frm_Cnt = 439 Frm_Sz = 2762240 B

Prod = 75 Cons = 74  Prtl_Sz = 6160 Frm_Cnt = 440 Frm_Sz = 2767360 B

Prod = 75 Cons = 74  Prtl_Sz = 6160 Frm_Cnt = 441 Frm_Sz = 2767360 B

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 91 Cons = 90  Prtl_Sz = 784 Frm_Cnt = 442 Frm_Sz = 3351040 B

Prod = 30 Cons = 30  Prtl_Sz = 19360 Frm_Cnt = 443 Frm_Sz = 1123840 B

Video timer

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

0 Likes

Hello,

Please find my comments below:

1. Please share me the complete project. This is because I would like to have a detailed check on the MIPI configurations and the descriptors.

2. Use Wire shark and send me the USB Trace. This can be used to find out where exactly the streaming of data to host is breaking and the size of data sent to the host.

3. Also share the UART prints that are obtained using teraterm.

Can you please try streaming using MPC-HC or AmCap and let me know if you are seeing the same behaviour using these applications also?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

>Can you please try streaming using MPC-HC or AmCap and let me know if

>you are seeing the same behaviour using these applications also?

Same behaviour with AmCap: pausing playback stops messaging from the CX3UVC, playing back again I can see lihe on the UBS xfers. Things like

I understands that packets are recived by the producer (MIPI periheral) and transferred over the USB by the consumer

Below the dump of the UART output

At reset (please ignore the Write Failed @addr= messagessince sensor configuration is done off-line

bRType = 0x2, bRequest = 0x1, wValue = 0x0, wIndex = 0x83, wLength= 0x0

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 1::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 1::1

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22

Writing Configuration Settings:

USB Setup CB:Call AppSTOP1

AplnStop:SMState = 0x2

AplnStrt:SMState = 0x2

bRType = 0x81, bRequest = 0x0, wValue = 0x0, wIndex = 0x0, wLength= 0x2

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

AppInit:GpifSMStart passed

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

Write Failed @addr=0x1A

Write Failed @addr=0x1A

Write Failed @addr=0x1A

***I: Sensor(0x90) initialization

Writing Configuration Settings:

Register = 0x98E: Value = 0xC97E

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

Write Failed @addr=0x98E

StpCB:In SET_FTR 0::1

Write Failed @addr=0x98E

Write Failed @addr=0x98E

Image Sensor Init Err = 0xFF

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22

Writing Configuration Settings:

AplnStrt:SMState = 0x2

Prod = 54 Cons = 54  Prtl_Sz = 13856 Frm_Cnt = 1 Frm_Sz = 2001920 B

Prod = 11 Cons = 11  Prtl_Sz = 7184 Frm_Cnt = 2 Frm_Sz = 412160 B

Prod = 49 Cons = 49  Prtl_Sz = 34096 Frm_Cnt = 3 Frm_Sz = 1838080 B

Prod = 46 Cons = 46  Prtl_Sz = 8864 Frm_Cnt = 4 Frm_Sz = 1702400 B

Prod = 75 Cons = 75  Prtl_Sz = 31760 Frm_Cnt = 5 Frm_Sz = 2792960 B

Prod = 58 Cons = 58  Prtl_Sz = 22752 Frm_Cnt = 6 Frm_Sz = 2158080 B

When streaming

Video timer

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Prod = 55 Cons = 54  Prtl_Sz = 80 Frm_Cnt = 2321 Frm_Sz = 2024960 B

Prod = 83 Cons = 83  Prtl_Sz = 29072 Frm_Cnt = 2322 Frm_Sz = 3084800 B

Prod = 28 Cons = 28  Prtl_Sz = 33352 Frm_Cnt = 2323 Frm_Sz = 1064200 B

Prod = 38 Cons = 38  Prtl_Sz = 6432 Frm_Cnt = 2324 Frm_Sz = 1405440 B

Prod = 51 Cons = 51  Prtl_Sz = 9104 Frm_Cnt = 2325 Frm_Sz = 1886720 B

Prod = 49 Cons = 48  Prtl_Sz = 3376 Frm_Cnt = 2326 Frm_Sz = 1807360 B

Prod = 13 Cons = 13  Prtl_Sz = 33392 Frm_Cnt = 2327 Frm_Sz = 512000 B

Prod = 45 Cons = 45  Prtl_Sz = 20080 Frm_Cnt = 2328 Frm_Sz = 1676800 B

Prod = 78 Cons = 78  Prtl_Sz = 5792 Frm_Cnt = 2329 Frm_Sz = 2877440 B

Prod = 40 Cons = 40  Prtl_Sz = 35200 Frm_Cnt = 2330 Frm_Sz = 1507840 B

0 Likes

Hello Marco,

According to my understanding, in the logs shared before whatever comes before When streaming is obtained without starting host application and whatever comes afterwards are obtained after starting the host application. Please correct me if I'm wrong.

For better understanding of this issue, please do the following 

1.Please share the complete project.

2.Also, please share the UART prints using teraterm.

Best Regards,

Jayakrishna

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

First of all many thanks for your offer to look at the project file (Attached: project name is 'pinco')

Let me explain a bit the background of our system

1. I started working on a customer board derived from Denebola with the important addition of an FPGA getting two left-right eye MIPI streams 1280x720@24fps and merging into a single 2560x720p@24fps: this merged MIPI is sent to the CX3. My question is: can host UVC on the PC support such resolution

2. Since the FPGA is not working so far (hopefully tomorrow will) , we bypassed the merging device and send the MIPI output of a single sensor to the CX3 MIPI (also to scale down the complexity: make it working with one sensor first, then two sensors + merging). Bypass has bee done by external wires, so I was concerned about signal integrity, still I think the CX can get MIPI data, though corrupted somehow. Still this setup is of concern since I am not sure if UVC host can handle this resolution (it is out of quetion design a special host for this ...).

I then report a step forward in the process. I changed the resolution from 1288x728@24fps to 1280x720@24.5fps, guessing that the first combination will not please the UVC host. Now I can then see 'something' on the VLC screen as well as AMCap - after one minute the player started playing, why I cannot explain - so my understanding is that 1288x728@24.5 fps (we were driven to enter this number from aptina documentation and support people). 'Something' mean a lousy image (not video coming from the sensor

I removed from the project files the contents of the APIs which may be IP sensitive for eOn/Aptina (the software application is under NDA), the program should be compile clean under eclipse thous; BTW the USB related code is there: please check the parameters and let me know

Regards

0 Likes

Hello,

I will have a look through the project and let you know if I find some problems in it. I assume that the bits per pixel is 16. Please correct me if I'm wrong. Also, please confirm which resolution and fps are you trying to stream now.Is it 1280*720 @ 24fps or is it 1280*720 @ 24.5fps or is it 1288*728@24fps or is it 1288*728@24.5fps.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

>Please correct me if I'm wrong. Also, please confirm which resolution and fps

>are you trying to stream now.Is it 1280*720 @ 24fps or is it 1280*720 @ 24.5fps

>or is it 1288*728@24fps or is it 1288*728@24.5fps.

Thanks. The project I sent is 1288*728@24.5fps: you can see it opening the configuration file. Sorry for the confusion

Regards

0 Likes

Sorry,

The project I sent is 1280*720@24.5fps: you can see it opening the configuration file. Sorry for the confusion

Regards

0 Likes

Coding is YUY2 with 16bit per pixel to please UVC

0 Likes

Hello Marco,

Also, from the logs shared before, I saw that CyU3PI2cTransmitBytes() API was failing. This was shown as

Write Failed @addr=0x1A

Write Failed @addr=0x98E

You mentioned that the writes are done Off line in the logs. Please confirm whether the sensor configuration settings were written properly.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

Hello Jayakrishna

thanks much for your help, really appreciated. Yes the failures you reported are due to a disconnected I2C and must be ignored since sensor configuration is done by disconnecting the I2C from the CX3 of our system, using the CX3 house by the on semi eval board. We check that the sensor is correctly configured by using the On Semi client application running on a Win 10 PC

I will try your suggestions ASAP and let you know

0 Likes

Hello Marco,

Please find my suggestions in the MIPI configuration Utility for your project

- In the CX3 Receiver Configuration Tab, Change the Output Parallel Clock Divider from 8 to 4.

- In the CX3 Receiver Configuration Tab, Change the FIFO Delay to 400.

Also please confirm that the sensor is streaming data using 1 lane only.

Once you set the new configuration, please save all the files. This will add the modified sources to the project. After this, please follow the steps given below:

1. Ensure that you have added the sensor configuration settings for streaming the 720p video correctly.

2. Did you change the DMA Buffer size in the project? I find that the DMA buffer size in this project is 0x8FF0. This is greater than 32KB which is described in the probe control structure in the uvcdscr.c file. Please change it to 0x5FF0 or 0x3FF0.

3. Please make use of the API CyU3PMipicsiSetPhyTimeDelay(1,0x 07); just before CyCx3_ImageSensor_Set_1280x720(); function inside the function CyCx3UvcAppImageSensorSetVideoResolution() in uvc.c file. This is used for setting the PHY time delay. The same PHY time delay that is obtained from the CX3 Receiver Configuration Tab of MIPI Configuration Utility can be used for this. In your case it is 7. SO you can use 0x07 as the second parameter for the API CyU3PMipicsiSetPhyTimeDelay.

4. Also, I find that the disable LPM API is used inside the DMA Callback where as in the example project that comes along with FX3 SDK (Cx3UvcOV5640), it is inside CyCx3AppStart() function. Please do not add any extra delay in the DMA Callback as there are possibilities that it can affect proper streaming of data. In fact, please do not modify the default project.

You can refer to the following KBA to understand Steps to setup MIPI CSI Camera Solution with CX3.

Steps to Setup up MIPI CSI Camera Solution with CX3 – KBA225748

Please follow the steps exactly. Also, do not make any changes on the source files in the project unless it is mentioned in the KBA. 

Please try the above recommendations and check whether the video is streaming properly.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

2. Did you change the DMA Buffer size in the project? I find that the DMA buffer size in this project is 0x8FF0. This is greater than 32KB which is described in the probe control structure in the uvcdscr.c file. Please change it to 0x5FF0 or 0x3FF0.

No I didn't ... I let the value generated during configuration in the header file

/*CX3_UVC_DATA_BUF_SIZE value of 0x8000 is compatible with 16-bit GPIF configuration;

* When using Streamer for getting the video data CX3_UVC_DATA_BUF_SIZE has to be a

* multiple of End point max packet size (1024), hence 0x8000 was chosen for CX3_UVC_DATA_BUF_SIZE when the application is non-UVC;

* CAUTION: 0x6000 can be used and is compatible with both 16-bit/24-bit GPIF, but cannot be used for 720p;

* 720p frame size is exact multiple of 0x6000, hence the frame end cannot be

* detected with this value for 720p, since partial buffer does not exist in this case;

* When using UVC, 0x8FD0 for CX3_UVC_DATA_BUF_SIZE will work for 16-bit/24-bit GPIF configuration and for all resolutions

* with 3 as CX3_UVC_STREAM_BUF_COUNT;

*/

#ifdef UVC_APPLICATION

#define CX3_UVC_DATA_BUF_SIZE                   (0x8FD0)

#else

#define CX3_UVC_DATA_BUF_SIZE                   (0x8000)

#endif

I cannot locate 0x8ff0 anywhere. Please explain (which MACRO am I supposed to change)?

thanks

0 Likes

Hello,

There was a small mistake in my last post. Apologies for that. Your payload size in probe control and DMA buffer size looks okay. Please ignore the second point in my previous response.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

4. Also, I find that the disable LPM API is used inside the DMA Callback where as in the example project that comes along with FX3 SDK (Cx3UvcOV5640), it is inside CyCx3AppStart() function. Please do not add any extra delay in the DMA Callback as there are possibilities that it can affect proper streaming of data. In fact, please do not modify the default project.

should I then comment out the CyU3PUsbLPMDisable() call in the CyCx3UvcAppDmaCallback? Please explain, this is sensitive real time code and I am scary of messing up everything

I think I did not add it ...

BTW printflag is never asserted so I did a step back comparing to a former situation which shows attempts to stream data outside toward the USB , I just get

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 0::1

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22

Writing Configuration Settings:

AplnStrt:SMState = 0x2

0 Likes

update. After minutes I can see see video data on VLC player. It takes long time for this to happen.

Comments please? There is a Long Latency, donno understand why

0 Likes

Hello,

Apologies for another mistake, regarding LPMDisable(), you need not comment it out. I just found that in another example project that LPMDisable is called inside Prod_Event with the same delay.

Please send the USB traces using Wireshark or Lecroy Hardware analyzer traces (preferably).

Also, how much time is it taking to start the streaming of video and does it get stuck in between?

Are you seeing the same behaviour with a different host application?

I didnt understand clearly about the printflag which you mentioned in reply 21. Can you please make it more clear?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

Apologies for another mistake, regarding LPMDisable(), you need not comment it out. I just found that in another example project that LPMDisable is called inside Prod_Event with the same delay.

no problem for that

Please send the USB traces using Wireshark or Lecroy Hardware analyzer traces (preferably).

Attached. I send the log while the UVC is streaming. Not sure what you will get from it. Plese sugegst some filtering or other options

Also, how much time is it taking to start the streaming of video and does it get stuck in between?

It takes minutes (maybe two) after the CX3 applicaion starts, open VLC player and see the movie .. if I then pause VLC it look like it neve restarts (it is 2:39 minute I am waiting now ....)

Are you seeing the same behaviour with a different host application?

So far with AMCap I cannot see the video starting at all ... all of this is so ... temperamental

I didnt understand clearly about the printflag which you mentioned in reply 21. Can you please make it more clear?

It is a flag enabling thiese printouts

imeDiff = 1221 ms FPS = 24

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101521 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101522 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101523 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101524 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101525 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101526 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101527 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101528 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101529 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101530 Frm_Sz = 1843200 B

Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101531 Frm_Sz = 1843200 B

and this is the code

#ifdef PRINT_FRAME_INFO

if (Printflag == 1)

{

/*For video streaming application of higher FPS refrain from using this debug print or try to reduce the print information*/

CyU3PDebugPrint(4,"\n\rProd = %d Cons = %d  Prtl_Sz = %d Frm_Cnt = %d Frm_Sz = %d B", TxCountflag, RxCountflag, PartialBufSize, FrameCount, ((TxCountflag*CX3_UVC_DATA_BUF_SIZE)+PartialBufSize));

Printflag = 0;

if (fpsflag == 1)

{

fps = 30000/(time1 -time0); //FPS calculate using time difference for 30 frames

CyU3PDebugPrint(4,"\n\rTimeDiff = %d ms FPS = %d", (time1 -time0), fps);

fpsflag = 0;

}

0 Likes

Hello,

I didnt find the USB logs in your previous reply. Please share the same.

Also, please check whether you are getting the same delay as that of the initial delay once you pause and restart the application.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Actually I reprogrammed the CX3 with the same image but I cannot see video any longer ... sequence is

- close VLC

- reprogram and start CX3

- check that there is activity on the MPI input

- open VLC

- specify capure device as CX3-UVC

- play: I can see this on the teraterm log

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22

Writing Configuration Settings:

AplnStrt:SMState = 0x2

Then nothing happens ...

The wshark log file is too large to attach here. for unknown reasons I cannot zip this ... let me retry

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

here it is

0 Likes

3. Please make use of the API CyU3PMipicsiSetPhyTimeDelay(1,0x 07); just before CyCx3_ImageSensor_Set_1280x720(); function inside the function CyCx3UvcAppImageSensorSetVideoResolution() in uvc.c file. This is used for setting the PHY time delay. The same PHY time delay that is obtained from the CX3 Receiver Configuration Tab of MIPI Configuration Utility can be used for this. In your case it is 7. SO you can use 0x07 as the second parameter for the API CyU3PMipicsiSetPhyTimeDelay.

I make things slightly different: the video resolution is set during initialization at the end of AppInit in imagesensor.c reading the array of register address-value pair

static const CySensorReg16_t _baseConfigurationSettings16 [] =

{

....

  {0xC856, 0x0000},    //cam_crop_window_yoffset = 0

  {0xC858, 0x0500},    //cam_crop_window_width = 1280

  {0xC85A, 0x02D0},    //cam_crop_window_height = 720

...

};

_sz = (sizeof(_baseConfigurationSettings16_a))/(sizeof(CySensorReg16_t));

    _status = _writeConfigurationSettings_Reg16(devid, _baseConfigurationSettings16_a, _sz);

    if(_status != CY_U3P_SUCCESS)

    return _status;

which means the CyCx3_ImageSensor_Set_1280x720 do nothing since resoultuion has been set before

I call CyU3PMipicsiSetPhyTimeDelay(1,0x 07); jus befor initialization

0 Likes

if I push sop on VLC

bRType = 0x2, bRequest = 0x1, wValue = 0x0, wIndex = 0x83, wLength= 0x0

bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

StpCB:In SET_FTR 1::1

If I then push start

bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

StpCB:In SET_FTR 1::1

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22

bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22

Writing Configuration Settings:

USB Setup CB:Call AppSTOP1

AplnStop:SMState = 0x2

AplnStrt:SMState = 0x2

Pushing pause has no effect on teraterm screen

Video is blank, though. It take 2-3 mins for popping up

0 Likes

some more facts and background:

the MIPI stream is generated by and Lattice FPGA which merges 2 x 1280x768 MIPI striam into a 2560x760 MIPI stream. Actually it has been reprogrammed as a MIPI repeater (input: MIPI stram 1280x720, output MIPI 1280x720) to debug the USB and not to add complexity

The video appears immdiately IF

- the CX3 is running

- reprogam the FPGA

If Iet the FPGA up and powered BUT I exit and reneter VLC it does not work any longer

I do not know how exactly the MIPI stream trigger the MIPI peripheral embedded in the CX3 MCU and also how the Lattice repeater IP acts during startup.

Maybe the CX3 is synchronizing to some MIPI packets which are not there if I start and stop playback on VLC ...?

For sure I will talk about this with Lattice

0 Likes

Hello,

Please do the following:

1. I think you have connected more than one USB devices to your PC. Please connect only CX3 to the PC and share the wireshark log when the device fails to stream 1280*720p resolution.

2. The API CyU3PMipicsiSetPhyTimeDelay(1,0x 07); should be called after CyU3PMipicsiSetIntfParams() API is called. Please call it immediately after CyU3PMipicsiSetIntfParams() is called.

3. In reply 24, I saw that from the teraterm logs, the video is streaming properly. Please let me know what additional modification did you do in between reply 24 and reply 26.

From reply 30, my understanding is that CX3 streams the video data without any delay properly if you program CX3 first followed by FPGA and then opening VLC player. Please let me know if I'm wrong. This sequence is correct. Please share the USB logs when you try to close and reopen the VLC keeping FPGA powered up. Make sure that you have only CX3 connected to PC.

Best Regards,

Jayakrishna

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

1. I think you have connected more than one USB devices to your PC. Please connect only CX3 to the PC and share the wireshark log when the device fails to stream 1280*720p resolution.

here you go. I stopped VLC playback and the play again

2. The API CyU3PMipicsiSetPhyTimeDelay(1,0x 07); should be called after CyU3PMipicsiSetIntfParams() API is called. Please call it immediately after CyU3PMipicsiSetIntfParams() is called.

Did it

3. In reply 24, I saw that from the teraterm logs, the video is streaming properly. Please let me know what additional modification did you do in between reply 24 and reply 26

Indeed I think these logs refers to proper streaming. You should ignore them. I'll chek better though

From reply 30, my understanding is that CX3 streams the video data without any delay properly if you program CX3 first followed by FPGA and then opening VLC player. Please let me know if I'm wrong. This sequence is correct.

Yes: this is the working sequence

Please share the USB logs when you try to close and reopen the VLC keeping FPGA powered up. Make sure that you have only CX3 connected to PC.

here you go (foo1). FYI, I disconned all the USB devise except mouse and keybord (namely I disconnected the FTDI we have on board to program the FPGA and the FTDI to communcate with the UART)

Best Regards,

Jayakrishna

regards to you abnd thanks for the VERY helpful attitude

0 Likes

Hello,

These logs actually shows no data transfer to the host.

Are you seeing any delay in streaming the video now?

If yes, please share the wireshark trace for the case when you get the video streamed after the delay.

If the problem of delay is solved but the video is not streaming after you restart the VLC player, then share the debug prints while this is happening. This can be used to understand whether the problem is related to CX3 or FPGA.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Actually I cannot see any video since long time. I restarted the CX3, which has reconfigured the sensors correctly as far as I can see.

Still no video since 10 minutes ... this is cannot be easily replicated now

BTW I will move to setup the FPGA (the goal is using the 2:1 lattice IP merging a pair 640x720p into a single 1280x720 stream

A a side Question: can UVC support 2560x720p or should I design a new video class for this?

thanks

0 Likes

Hello Marco,

Did you program CX3 first followed by FPGA and then open VLC in your last test?

Regarding your question on 2560 * 720p. Yes this can be supported as the bandwidth is less than maximum supported USB 3.0 Bandwidth. But you will have to change the descriptors and probe control structure for this.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Yes but I was asking about which resolutions are supported by uvc on the windows side. For example raw video is not supported by uvc vide class. I was asked by my customer to investigate on this.

0 Likes

Hello,

UVC does not support RAW formats. But it supports YUY2 format. According to my understanding, you were trying to stream 1280*720p in YUY2 format. So I thought you would be using the same for 2560*720p also.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

yes: this mean that UVC will work with 2560x720p resolution, right?

On Thu, Feb 6, 2020 at 3:03 PM JayakrishnaT_76 <

0 Likes

Hello,

Yes UVC will support streaming of 2560x720p resolution in YUY2 Format.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes