cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

Bindu
New Contributor

Hi

I am developing a firmware that streams data  at 1080p@30 fps, I have  attached the parameters given I am not able to do streaming , the project is also attached , Is there any wrong configuration setting.

Thanks in Advance

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator

Hello, 

If 1280*720*2 resolution is streamed, in the USB traces 50 FULL DMA buffer s and 1 partial DMA buffer are expected to be seen.

But as mentioned earlier, either due to MIPI transmitter/receiver setting mismatch or the MIPI lane errors, the video frames are not received as expected by CX3.

Please confirm if you have tried the following as asked in my previous response

"Also, try setting the PHY Time Delay value as per the CX3 MIPI Receiver Configuration tool (refer to attached snippet).

CyU3PMipicsiSetPhyTimeDelay API   is used to set the CX3_PHY_TIME_DELAY register values. This function should be not be called while the MIPI-CSI PLL clocks are active. Either call after calling CyU3PMipicsiSetIntfParams() with wakeOnConfigure set to False (before calling CyU3PMipicsiWakeup() ), or call CyU3PMipicsiSleep() before calling this API.

CyU3PMipicsiSetPhyTimeDelay (1,0x08); //as per attached cx3 configuration. the delay value should be set as per your configuration settings"

If yes, please let me know if there is a possibility to connect the UART port for getting the debug prints. This will help us to know the exact reason of the error as the CDC interface firmware didn't help.

Regards,
Rashi

View solution in original post

0 Likes
37 Replies
Rashi_Vatsa
Moderator
Moderator

Hello,

The Cx3 MIPI Receiver settings seems fine for 1080p resolution.

Please share the UART debug prints for us to check. Please enable the macros like CX3_DEBUG_ENABLED and PRINT_FRAME_INFO before taking the traces.

Also, let me know if you have the test points as in Q10 of this KBA CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community 

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hello Rashi,

It is our customised board , UART pins are  not taken in design.

Also, let me know if you have the test points as in Q10 of this KBA CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community 

- Yes we have test points as in Q10.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please probe the all the three test points an share the traces for us to check if the signals are as expected.

Please share the traces such that we can check the PCLK frequency, H Active, H blanking, V Active and V blanking time in the trace.

Regards,
Rashi
0 Likes
Bindu
New Contributor

PCLK  frequency and trace is as attached in the image , HYSC and VYSC are zero.

PCLK-min.jpg

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

This generally happens when MIPI transmitter (sensor) and MIPI receiver (CX3) are not in sync.

Please check if the MIPI transmitter is configured with the same settings as CX3 MIPI receiver settings. 

Please let me know if the sensor supports continuous clock or gated (non continuous clock). Refer to Q13 of this KBA CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community  for the changes if continuous clock mode is used

As mentioned in the thread CX3 MIPI Configuration - Cypress Developer Community please share the UART debug prints after enabling macros  like CX3_DEBUG_ENABLED and PRINT_FRAME_INFO

Regards,
Rashi
0 Likes
Bindu
New Contributor

Please let me know if the sensor supports continuous clock or gated (non continuous clock). Refer to Q13 of this KBA CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community  for the changes if continuous clock mode is used

Gated clock

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

To check if all the API pass while initializing the CX3 MIPI block, we would need the debug prints.

Please check if the MIPI transmitter is configured with the same settings as CX3 MIPI receiver settings.

Please refer to the firmware shared in the thread Solved: Stream RAW10 with 24bit output format - Cypress Developer Community . The firmware uses CDC interface to send the debug prints to USB host instead of UART. Similar changes can be done to your firmware.

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi Rashi,

As mentioned in above thread ,  I tried to implement the same I have attached the device manager image , Is there any driver required or somewhere Am I going wrong.

Devicemanager_img.jpg

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

I understand that you have followed the firmware shared in the thread pointed and implemented the same to your firmware. Is that correct?

If yes, please share the modified firmware for us to check

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi Rashi,

Thanks for your support

I have attached the code, please let me know if any changes need to done.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please find the attached firmware. It has been tested at my end and it is working fine.

Please check the results.

Please try uninstalling the device (CX3-UVC) from the device manager and plug the device again with the attached firmware programmed and let me know the results

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi,

I tried programming the firmware , and uninstalled the CX3-UVC device from the device manager,

COM port is detecting but nothing is printing in the putty, please find the attachment.

Capture.PNG

 

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please confirm if the CX3-UVC interface comes up as expected  (under Camera section) of the device manager.

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi,

Yes, It is as expected , both CX3-UVC and COM port is detecting, nothing is printing in the putty,

when i open camera application (e-CAMview), it is hanging.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please find the attached firmware. I have marked the changes need to get the debug prints via CDC interface. Macro #defineCDC is used to add changes in man source file needed to print via CDC interface. You can track the macro to find the changes done to the firmware. Same changes can be done in your firmware.

Please note the changes does not include USB descriptors as the descriptors in the firmware shared by you were fine.

After the modification to your firmware build the firmware and follow these steps.

  1. Program the device
  2. Open tera term
  3. Then reset the device without closing tera term
  4. Program device again

Please let me know if the firmware works. We have tested it at out end and it works as expected

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi,

Thanks for your support,

The firmware is  working as expected, now where I should add the debug print lines to get debug print of my project.

 

Capture2.PNG

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

I have already added the debug print. Please let me know if these prints are taken when the streaming is started i.e. host application is opened.

The variable TxCount will track the CY_U3P_DMA_CB_PROD_EVENT (i.e. the no. of DMA buffers received by CX3) and the variable RxCount will track the CY_U3P_DMA_CB_CONS_EVENT (i.e. the no. of DMA buffers consumed by host)

Please enable all the debug prints in CyCx3UvcAppStart and CyCx3UvcAppStop functions and start the streaming. Please share the UART debug prints after the test

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi,

Please enable all the debug prints in CyCx3UvcAppStart and CyCx3UvcAppStop functions and start the streaming. Please share the UART debug prints after the test

- I have attached the uart print, whenever I open the application (e-CAMview), it is getting hanged, this is after adding CDC function.

Capture.PNG

 It is not entering to CyCx3UvcAppStart , I have added print1 , print2, and print3

It is directly printing print3,

status = CyU3PEventGet (&glCx3Event, CX3_USB_SUSP_EVENT_FLAG | CX3_DMA_RESET_EVENT,
CYU3P_EVENT_OR_CLEAR, &eventFlag, CYU3P_NO_WAIT);
if (status == CY_U3P_SUCCESS)
{
CyU3PDebugPrint(4,"\n\r Print1");
if (eventFlag & CX3_DMA_RESET_EVENT)
{
CyU3PDebugPrint(4,"\n\r Print2");
if (dma_reset_flag == 0)
{
CyU3PDebugPrint(4,"\n\rCB failure");
}
else if (dma_reset_flag == 1)
{
CyU3PDebugPrint(4,"\n\rVideo timer");
}

#ifdef PRINT_FRAME_INFO
TxCount = 0;
RxCount = 0;
#endif
dma_reset_flag = 0;
/* Frame timed out. Abort and start streaming again. */
if (glIsApplnActive)
{
CyCx3UvcAppStop();
}

CyCx3UvcAppStart();

#ifdef RESET_TIMER_ENABLE
CyU3PTimerStop (&UvcTimer);
CyU3PTimerModify (&UvcTimer, TIMER_PERIOD, 0);
#endif
}
#ifdef Fx3
/* Handle Suspend Event*/
if (eventFlag & CX3_USB_SUSP_EVENT_FLAG)
{
/* Place CX3 in Low Power Suspend mode, with USB bus activity as the wakeup source. */
CyU3PMipicsiSleep();
CyCx3_ImageSensor_Sleep();

status = CyU3PSysEnterSuspendMode (CY_U3P_SYS_USB_BUS_ACTVTY_WAKEUP_SRC, 0, &wakeReason);
// CyU3PDebugPrint (4, "\n\rEnterSuspendMode Status = 0x%x, Wakeup reason = 0x%x", status, wakeReason);
if (glMipiActive)
{
CyU3PMipicsiWakeup();
CyCx3_ImageSensor_Wakeup();
}
}
#endif
}
else
{
CyU3PDebugPrint(4,"\n\r Print3");
continue;
}

Capture1.PNG

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please share the firmware with which the problem is seen.

The CyCx3UvcAppStart will be called from the SET_CUR request handler in the firmware. Please try putting a debug print there and make sure the CX3_DEBUG_ENABLED is commented out.

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi,

I have attached the firmware

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please try using MPC-HC or Amcap host application to view the stream

From the debug prints it seems that the data is nor received by the CX3. Please check if the MIPI transmitter (sensor) settings are same as the CX3 MIPI receiver settings.

In the firmware share by you, I noticed that CyU3PMipicsiSleep is commented out in the CyCx3UvcAppStart. Please let me know the reason.

To check if there are some MIPI errors, please try printing this and share the debug prints

CyU3PDebugPrint(4,"\n\r Prints");
        CyU3PDebugPrint(4,"\n\r Prod = %d Cons = %d \n\r ", TxCount, RxCount);
        CyU3PMipicsiGetErrors( CyTrue, &errCnts);

       CyU3PDebugPrint(4,"\n\r%d %d %d %d %d %d %d %d %d",errCnts.crcErrCnt,errCnts.ctlErrCnt, errCnts.eidErrCnt, errCnts.frmErrCnt, errCnts.mdlErrCnt, errCnts.recSyncErrCnt, errCnts.recrErrCnt, errCnts.unrSyncErrCnt, errCnts.unrcErrCnt );

 

Also, try setting the PHY Time Delay value as per the CX3 MIPI Receiver Configuration tool (refer to attached snippet).

CyU3PMipicsiSetPhyTimeDelay API   is used to set the CX3_PHY_TIME_DELAY register values. This function should be not be called while the MIPI-CSI PLL clocks are active. Either call after calling CyU3PMipicsiSetIntfParams() with wakeOnConfigure set to False (before calling CyU3PMipicsiWakeup() ), or call CyU3PMipicsiSleep() before calling this API.

CyU3PMipicsiSetPhyTimeDelay (1,0x08); //as per attached cx3 configuration. the delay value should be set as per your configuration settings

Regards,
Rashi
0 Likes
Bindu
New Contributor

From the debug prints it seems that the data is nor received by the CX3. Please check if the MIPI transmitter (sensor) settings are same as the CX3 MIPI receiver settings.

Yes the MIPI settings are same.

To check if there are some MIPI errors, please try printing this and share the debug prints

CyU3PDebugPrint(4,"\n\r Prints");
CyU3PDebugPrint(4,"\n\rProd = %d Cons = %d \n\r ", TxCount, RxCount);

CyU3PDebugPrint(4,"\n\r%d %d %d %d %d %d %d %d %d",errCnts.crcErrCnt,errCnts.ctlErrCnt, errCnts.eidErrCnt, errCnts.frmErrCnt, errCnts.mdlErrCnt, errCnts.recSyncErrCnt, errCnts.recrErrCnt, errCnts.unrSyncErrCnt, errCnts.unrcErrCnt );


239 239 1 239 239 0 0 83 0
Prints
Prod = 0 Cons = 0

239 239 1 239 239 0 0 83 0
Prints
Prod = 0 Cons = 0

this is the print which we are getting, i have attached the debug print.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please refer to MIPI-CSI Protocol and Physical Layer Errors in CX3... - Cypress Developer Community  KBA for details of the errors.

It seems that there are many MIPI errors. Please confirm if routing guidelines mentioned in Q8 of this KBA CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community  is followed. Also confirm if the CX3 MIPI Transmitter is MIPI CSI-2 compliant (Version 1.01, Revision 0.04 – 2nd April 2009)

Regards,
Rashi
0 Likes
Bindu
New Contributor

It seems that there are many MIPI errors. Please confirm if routing guidelines mentioned in Q8 of this KBA CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community  is followed. Also confirm if the CX3 MIPI Transmitter is MIPI CSI-2 compliant (Version 1.01, Revision 0.04 – 2nd April 2009)

We have followed same routing guidelines ,

I have one more query , before adding CDC function when I probe , I can see the data, once we add CDC function  I am not getting any data while probing, while adding CDC is giving some problem ?

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please let me know where did you probe the data. Is it on the HYSNC,VSYNC test points or on the USB?

In your previous response, you had mentioned that no signal is seen on test points which means that the data is not received correctly from the sensor 

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi,

Please let me know where did you probe the data. Is it on the HYSNC,VSYNC test points or on the USB?

We are probing near MIPI data lanes 

If we send the configuration register settings to sensor in the AppStart function, the the sensor will start through the mipi data. after adding CDC, the appstart function is not calling in the firmware.so we couldn't able to send the register settings to receive MIPI data from sensor.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Understood.

When the data was seen MIPI lines (i.e. while using the firmware without CDC) the HSYNC and VSYNC test points didn't show the signals. Is my understanding right?

If the MIPI transmitter (sensor) and MIPI receiver (CX3) settings match the signals will be seen on the test points. If the signals are not seen there is some issue between the settings of the MIPI transmitter and receiver.

To check if the Appstart is called, please try the following:

- comment all the CyU3PDebugPrint calls in the firmware

- Add 2 CyU3PDebugPrint calls i.e. at start of CyCx3UvcAppStart and in CyCx3UvcAppHandleSetCurReq 

static void
CyCx3UvcAppHandleSetCurReq (
uint16_t wValue
)
{ CyU3PDebugPrint (4, "\n\r USB Setup CB: Entered CyCx3UvcAppHandleSetCurReq");

....

CyU3PDebugPrint (4, "\n\r USB Setup CB: Call AppStart1");

CyCx3UvcAppStart();

..}

CyU3PReturnStatus_t
CyCx3UvcAppStart (
void)
{

CyU3PDebugPrint(4, "Entered CyCx3UvcAppStart ");

...}

Open the host application, select the device and share the UART debug prints after this test

You can use macro and disable the CDC interface and check if the signals are seen on HSYNC and VSYNC test points. The sensor vendor can be contacted to verify the sensor settings.

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi , 

We had some hardware problem so we were not able to get data in HYSC and VYSC  now we fixed that issue, and  removed CDC function, and tried probing , we are getting data in HYSC and VYSC , I had attached those image.

but when I open the host application nothing is streaming, it will show resolution : 640x480 and fps : 0

 

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please share the traces such that the H blanking, H active, V blanking, V active time can be checked

Please capture the USB traces using Wireshark and share the .pcap file. this is to check if the data is sent from Cx3 to host

You can follow the steps as below:

- Open Wireshark (USBPcap) capture

- Connect the programmed CX3 device

- Open the host application (like MPC- HC / AmCap), select the device and start streaming

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi,

Please share the traces such that the H blanking, H active, V blanking, V active time can be checked

 

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

From the shared traces, it is seen that the H blanking and H active period is not constant during the V Active time. It is expected that H blanking, H active, V blanking and V active time remains constant while video streaming.

There can be mainly two reasons for this

- MIPI errors: From the debug prints shared earlier, we could see a lot of MIPI errors. So we would recommend you to check the MIPI line routing and follow the guidelines CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community 

- Mismatch between MIPI receiver and MIPI transmitter settings

As asked in my previous response please capture the USB traces using Wireshark and share the .pcap file. This is to check if the data is sent from Cx3 to host.

Regards,
Rashi
0 Likes
Bindu
New Contributor

Hi,

MIPI errors: From the debug prints shared earlier, we could see a lot of MIPI errors. So we would recommend you to check the MIPI line routing and follow the guidelines CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community 

We had followed same routing guidelines.

As asked in my previous response please capture the USB traces using Wireshark and share the .pcap file. This is to check if the data is sent from Cx3 to host.

I have attached the files below.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please confirm that host application like AmpCap/ eCamView was opened when USBPCap2 trace was taken. If no, please try selecting the camera device in the host application so that the streaming starts. In USBPcap2, there are no UVC requests or the stream data seen. After initial UVC requests, the streaming request will be sent from the host to start the streaming which is not seen. Also check, if the device comes up in device manager under Camera section.

Please share the USB traces again after following these steps:

- Open Wireshark (USBPcap) capture

- Connect the programmed CX3 device

- Open the host application (like MPC- HC / AmCap), select the device and start streaming

USBPcap1 doesn't show Cypress device.

Regards,
Rashi
0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

From the traces, it is seen that the frame data is being sent from CX3 but the frame size is varying. For host application to display the video, the frame size is expected to be constant.

For example: If the resolution is 1920*1080*2 (2 bytes/16 bits) the expected frame size is 4147200 bytes

The DMA buffer size (CX3_UVC_DATA_BUF_SIZE) in your firmware is 36816 Bytes (0x8FD0).

So, for complete frame to transfer, 112 Full (36816 bytes) and 1 partial (23808 bytes) DMA buffer are required.

In the traces, I could 6 full buffers and 1 partial buffer which varies in size. For all the resolutions that your firmware supports requires more buffer than sent by CX3.

1280*720*2 : requires 50 full DMA buffers and 1 partial buffer

640*480*2 : requires 16 full DMA buffers and 1 partial buffer

Please let me know which resolution was streamed while capturing the trace. As the frame size is varying/or not as mentioned in USB descriptor and probe control structure which can be due to the mismatch in settings of MIPI Receiver and transmitter, the video is not displayed.

Regards,
Rashi
0 Likes
Bindu
New Contributor

HI,

Yes , i have opened e-camview and started streaming, the captured files are attached

Capture.PNG

0 Likes
Bindu
New Contributor

Hi,

Please let me know which resolution was streamed while capturing the trace. 

1280*720*2

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello, 

If 1280*720*2 resolution is streamed, in the USB traces 50 FULL DMA buffer s and 1 partial DMA buffer are expected to be seen.

But as mentioned earlier, either due to MIPI transmitter/receiver setting mismatch or the MIPI lane errors, the video frames are not received as expected by CX3.

Please confirm if you have tried the following as asked in my previous response

"Also, try setting the PHY Time Delay value as per the CX3 MIPI Receiver Configuration tool (refer to attached snippet).

CyU3PMipicsiSetPhyTimeDelay API   is used to set the CX3_PHY_TIME_DELAY register values. This function should be not be called while the MIPI-CSI PLL clocks are active. Either call after calling CyU3PMipicsiSetIntfParams() with wakeOnConfigure set to False (before calling CyU3PMipicsiWakeup() ), or call CyU3PMipicsiSleep() before calling this API.

CyU3PMipicsiSetPhyTimeDelay (1,0x08); //as per attached cx3 configuration. the delay value should be set as per your configuration settings"

If yes, please let me know if there is a possibility to connect the UART port for getting the debug prints. This will help us to know the exact reason of the error as the CDC interface firmware didn't help.

Regards,
Rashi

View solution in original post

0 Likes