CameraSwitchFailed error when opening FX3 UVC camera in Windows Camera app

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

cross mob
jnagy
Level 5
Level 5
5 solutions authored 100 replies posted 100 sign-ins

I am trying to create a firmware which will enumerate the FX3 chip as a UVC camera which gets its video data from an internal FPGA. Our internal structure is very similar to the slfifosync example project, so I am using that as a base and then putting the UVC layer above it, however when I install the firmware and try to use the device, I am getting the following error in the Windows Camera app: "0xA00F4241 <CameraSwitchFailed> (0x80070018)" and I am not sure what is going wrong.

I am currently trying to get the device recognized as a camera with the ability to be opened in the application. When I use the unmodified cyfxuvc_an75779 example (which I am basing my UVC layer off of) it is recognized as valid camera and has a simple black screen as output. My application doesn't currently route any video data to the USB endpoint; I am just trying to get a black screen out.

Looking at the USB traffic with wireshark, the device looks to be properly enumerating but when I open it in the Camera app the device it stalls on the host's UVC probe request. I have checked the cyfxuvc_an75779 example and have the same endpoint 0 structure and signal handlers. I have removed all references to USB 2 in the descriptors and UVC firmware code. Any help in diagnosing the issue would be appreciated!

0 Likes
1 Solution
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

A camera switch error can be seen when the device does not respond properly to the UVC requests from the host.

In your case, the video streaming requests were not responded from the device. The cause of the issue was that glFxUVCEvent was not created anywhere in the code. Hence this resulted in the error.

Please add :  apiRetStatus = CyU3PEventCreate (&glFxUVCEvent); in the Applninit function.

I found few more issues with your firmware:

1. The endpoint dedicated for video streaming in the descriptor file should match with the USB socket dedicated for the DMA Channel for video streaming. I saw that CY_FX_EP_VIDEO_CONS_SOCKET was 0x03, but  CY_FX_CONSUMER_USB_SOCKET CY_U3P_UIB_SOCKET_CONS_1 and CY_FX_EP_CONSUMER were corresponding to socket 1.
Change the value of CY_FX_EP_VIDEO_CONS_SOCKET to 0x01.

2. I see that there is DMA channel created between a USB producer and GPIF consumer, but there is no OUT USB endpoint declared in the USB descriptor files. This will result in failure of the DMA channel creation between U to P.

3. An interrupt endpoint has been declared in the descriptor file, but the endpoint is not configured in the firmware, please do so.

4. (Optional) There is a difference in the burst length for the endpoint in the descriptor and the endpoint configuration. You could make both the same to make it work reliably.

Please correct all the above issues.

I have attached the firmware project with some of the above changes done. It works well on my side. Please try it out and let us know if the issue is seen.

Best Regards,
AliAsgar

 

View solution in original post

4 Replies
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

Device stalling the host's UVC probe request can be a possible cause of the issue.

Could you share the firmware project and wireshark traces with me? Start recording the traces before programming FX3 up till camera switch issue.
Also share the UART debug prints if enabled.

Best Regards,
AliAsgar

 

0 Likes
jnagy
Level 5
Level 5
5 solutions authored 100 replies posted 100 sign-ins

I do not have the UART prints enabled. Inside the zip is the firmware and wireshark traces. Thanks,

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

A camera switch error can be seen when the device does not respond properly to the UVC requests from the host.

In your case, the video streaming requests were not responded from the device. The cause of the issue was that glFxUVCEvent was not created anywhere in the code. Hence this resulted in the error.

Please add :  apiRetStatus = CyU3PEventCreate (&glFxUVCEvent); in the Applninit function.

I found few more issues with your firmware:

1. The endpoint dedicated for video streaming in the descriptor file should match with the USB socket dedicated for the DMA Channel for video streaming. I saw that CY_FX_EP_VIDEO_CONS_SOCKET was 0x03, but  CY_FX_CONSUMER_USB_SOCKET CY_U3P_UIB_SOCKET_CONS_1 and CY_FX_EP_CONSUMER were corresponding to socket 1.
Change the value of CY_FX_EP_VIDEO_CONS_SOCKET to 0x01.

2. I see that there is DMA channel created between a USB producer and GPIF consumer, but there is no OUT USB endpoint declared in the USB descriptor files. This will result in failure of the DMA channel creation between U to P.

3. An interrupt endpoint has been declared in the descriptor file, but the endpoint is not configured in the firmware, please do so.

4. (Optional) There is a difference in the burst length for the endpoint in the descriptor and the endpoint configuration. You could make both the same to make it work reliably.

Please correct all the above issues.

I have attached the firmware project with some of the above changes done. It works well on my side. Please try it out and let us know if the issue is seen.

Best Regards,
AliAsgar

 

jnagy
Level 5
Level 5
5 solutions authored 100 replies posted 100 sign-ins

Hello,

The Applninit function line fixed the issue. 

Thanks for the other modifications as well.

0 Likes