- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have implemneted the uvc extension in CX3, but it always failed in the test. I referenced the sample AN75779, Who can help to check where is the problem?
My steps:
1. add Extension Unit Descriptor in the cyfxuvcdscr.c ;
2. modify cycx3_uvc.h ;
3. modify cycx3_uvc.c
a. set event in CyCx3UvcAppUSBSetupCB();
b. get event in UVCAppEP0Thread_Entry(). if meet the conditions, it will execute UVCHandleExtensionUnitRqts(). But it seems that the conditions are always not met from the log.
#define CY_FX_UVC_VIDEO_CONTROL_REQUEST_EVENT (1 << 2)
#define CY_FX_UVC_VIDEO_STREAM_REQUEST_EVENT (1 << 3)
#define CY_FX_UVC_EXTENSION_UNIT_ID (uint8_t)(3) /* wIndex value used to select Extension Unit. */
for (;;)
{
/* Wait for a Video control or streaming related request on the control endpoint. */
#if 1
if (CyU3PEventGet (&glFxUVCEvent, eventMask, CYU3P_EVENT_OR_CLEAR, &eventFlag,
CYU3P_WAIT_FOREVER) == CY_U3P_SUCCESS)
{
CyU3PUsbGetSpeed ();
CyU3PDebugPrint(4,"michael: eventFlag = %d wIndex_mv = %d\n\r", eventFlag, wIndex_mv);
if (eventFlag & CY_FX_UVC_VIDEO_CONTROL_REQUEST_EVENT)
{
switch ((wIndex_mv >> 8))
{
case CY_FX_UVC_EXTENSION_UNIT_ID:
UVCHandleExtensionUnitRqts ();
break;
default:
/* Unsupported request. Fail by stalling the control endpoint. */
CyU3PUsbStall (0, CyTrue, CyFalse);
break;
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for you suggestion. I have found the issue. I create a new thread to get the control_request, but when i set the command from PC, the thread had already stopped, so the slave device had no response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following log (Line Number #8) indicates that there is a setup packet to the extension unit.
bRType = 0xA1, bRequest = 0x85, wValue = 0x100, wIndex = 0x300, wLength= 0x2michael: Set CY_FX_UVC_VIDEO_CONTROL_REQUEST_EVENT
Please check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, thanks for your support. I did a test today, just send a read command with UVCExtensionApp(the PC sample in AN75779 : open app --> input '2' ). It is confused that the PC only send 2 commands : GET_LEN_REQ and GET_DEF_REQ, no GET_CUR_REQ. I also catched the packages at the same time, it was the same as the log. Why the PC doesn't send GET_CUR_REQ command?
michael: CyCx3UvcAppUSBEventCB
EnterSuspendMode Status = 0x0, Wakeup reason = 0x8
bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0
bRType = 0xA1, bRequest = 0x85, wValue = 0x100, wIndex = 0x300, wLength= 0x2
bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also test the write command, the PC also only send 2 commands : GET_LEN_REQ and GET_DEF_REQ, no GET_CUR_REQ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please debug in the host application to find out whether it is handling other requests or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for you suggestion. I have found the issue. I create a new thread to get the control_request, but when i set the command from PC, the thread had already stopped, so the slave device had no response.