CX3: Extension unit command fails sometime with random behavior

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

cross mob
GaK_4661021
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hi,

We have implemented custom command for CX3 UVC application. We have 11 such custom commands. Below is the descriptor in firmware,

-------------------------------------------------------------------------------------------------------------------------------------------

/* Extension Unit Descriptor */

    0x1C,                               /* Descriptor size */

    CX3_CS_INTRFC_DESCR,                /* Class specific interface desc type */

    0x06,                               /* Extension Unit Descriptor type */

    0x03,                               /* ID of this terminal */

    0x0C, 0x89, 0xB6, 0xAC,         /* GUID specific to AN75779 firmware. Obtained from Visual studio */

    0xB3, 0xA3, 0x60, 0x40,

    0x8B, 0x9A, 0xDF, 0x34,

    0xEE, 0xF3, 0x9A, 0x2E,

    0x0B,                               /* Number of controls in this terminal */

    0x01,                               /* Number of input pins in this terminal */

    0x02,                               /* Source ID : 2 : Connected to Proc Unit */

    0x03,                               /* Size of controls field for this terminal : 3 bytes */

    0xFF, 0x07, 0x00,                   /* No controls supported */

    0x00,

-------------------------------------------------------------------------------------------------------------------------------------------

Below is the host application function we are using (Referenced from UVC Extension unit ).

HRESULT SetGetExtensionUnit(GUID xuGuid, DWORD dwExtensionNode, ULONG xuPropertyId, ULONG flags, void* data, int len, ULONG* readCount)

{

GUID pNodeType;

IUnknown* unKnown;

IKsControl* ks_control = NULL;

IKsTopologyInfo* pKsTopologyInfo = NULL;

KSP_NODE kspNode;

HRESULT hr = mSource->QueryInterface(__uuidof(IKsTopologyInfo), (void**)&pKsTopologyInfo);

CHECK_HR_RESULT(hr, "IMFMediaSource::QueryInterface(IKsTopologyInfo)");

hr = pKsTopologyInfo->get_NodeType(dwExtensionNode, &pNodeType);

CHECK_HR_RESULT(hr, "IKsTopologyInfo->get_NodeType(...)");

hr = pKsTopologyInfo->CreateNodeInstance(dwExtensionNode, IID_IUnknown, (LPVOID*)&unKnown);

CHECK_HR_RESULT(hr, "ks_topology_info->CreateNodeInstance(...)");

hr = unKnown->QueryInterface(__uuidof(IKsControl), (void**)&ks_control);

CHECK_HR_RESULT(hr, "ks_topology_info->QueryInterface(...)");

kspNode.Property.Set = xuGuid;              // XU GUID

kspNode.NodeId = (ULONG)dwExtensionNode;   // XU Node ID

kspNode.Property.Id = xuPropertyId;         // XU control ID

kspNode.Property.Flags = flags;             // Set/Get request

hr = ks_control->KsProperty((PKSPROPERTY)&kspNode, sizeof(kspNode), (PVOID)data, len, readCount);

CHECK_HR_RESULT(hr, "ks_control->KsProperty(...)");

done:

SafeRelease(&ks_control);

return hr;

}

We are facing a random issue with the above development. Most of the time, we are able to sent set/get commands on every control command of the extension unit but sometimes it fails with only one control command. If we observe failure with the particular control command then it is persistent for every retry unless we reflash the firmware on the CX3 side. Can you please help with this?

0 Likes
1 Solution

Hi,

Thanks for your response.

The "isHandled = CyTrue" statement was missing all "CX3_USB_UVC_GET_LEN_REQ" sub-case of each handler. I have added this statement at all "CX3_USB_UVC_GET_LEN_REQ" sub-case handler and now it seems like issue is fixed.

Thanks for your support.

View solution in original post

0 Likes
13 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please share the following details so that we can understand the issue better:

1. What happens when the failure happens? Please elaborate your observation so that we can understand better.

2. The complete project or the source in which the extension unit requests are handled.

3. Wireshark traces when a failure happens.

4. Please confirm that you are using SDK 1.3.4 and the build variable (in project properties) is 1_3_4 for the project as shown in the snapshot below.

pastedImage_0.png

Best Regards,

Jayakrishna

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

Hi,

Thanks for your response.

Please find my response below,

#1. In function SetGetExtensionUnit, Below line failed with error code 0x80070490,

            hr = ks_control->KsProperty((PKSPROPERTY)&kspNode, sizeof(kspNode), (PVOID)data, len, readCount);

      Below is the error message print we are getting for the same,

            info: Function: SetGetExtensionUnit, ks_control->KsProperty(...) failed, Error code: 0x80070490

#2. I will not able to share full source code as it has some custom development. But let me know which portion do you require so that I can send.

#3. Attached Wireshark logs. First control command(PropertyId = 0x07) is success and then in second control command(PropertyId = 0x02) we are facing issue in this case. There is no activity on Wireshark on the failure command.

#4. In our case SDK, 1.3.3 is used as I can see the build variable (in project properties) is set to 1_3_3. But when I check installed SDK version at "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3" it shows 1.3.4. How can I change the SDK version in the project?

0 Likes

Hello,

Please refer to Q4 of this KBA FX3/CX3: UVC Extension Unit Application – KBA230466  which explains the reason of the extension unit error and also mentions the debug steps.

Please let me know if any query on this

Regards,

Rashi

Regards,
Rashi
0 Likes

Hi,

Thanks for your response.

We are getting issue as per Question #4 mentioned here FX3/CX3: UVC Extension Unit Application – KBA230466 .

But in our case, We are using same firmware for multiple retries and sometime it works fine and sometime it fails. So there might not be issue related to descriptor otherwise it should fail everytime. So what could be the issue?

0 Likes

Hello,

Please share the Wireshark traces for the working condition and let me know-how many extension unit controls are added to the firmware as well as the host application.

Also, share the descriptor part (Extension Unit) of the firmware and the Extension unit request handling code.

Regards,

Rashi

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

Hi,

We are configured 12 extension unit controls in host application as well as in firmware.

Please find descriptor and extension unit control part source code in attachement. I have removed and marked custom source code with "//Custom_Code" string in source code. I will capture and share Wireshark trace soon.

Let me know if you require any other details.

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

Hi,

Please find attached Wireshark logs for the working scenario.

0 Likes

Hi,

Have you got the required information? Please help us with this issue.

0 Likes

Hello,

From the information that you have provided, I have observed two things

- isHandled = CyTrue is not called at the end of each case. Please let me know how is this variable used in the other part of the firmware.

- From the wireshark traces of non working condition, the host is not sending the request addressing the Extension unit (Entity 0x03)

wireshark.PNG

Please share the modified extension unit host application so that we can try reproducing the same at our end

Regards,

Rashi

Regards,
Rashi
0 Likes

Thanks for your input.

Below is the host application function we are using (Referenced from UVC Extension unit ).

HRESULT SetGetExtensionUnit(GUID xuGuid, DWORD dwExtensionNode, ULONG xuPropertyId, ULONG flags, void* data, int len, ULONG* readCount)

{

GUID pNodeType;

IUnknown* unKnown;

IKsControl* ks_control = NULL;

IKsTopologyInfo* pKsTopologyInfo = NULL;

KSP_NODE kspNode;

HRESULT hr = mSource->QueryInterface(__uuidof(IKsTopologyInfo), (void**)&pKsTopologyInfo);

CHECK_HR_RESULT(hr, "IMFMediaSource::QueryInterface(IKsTopologyInfo)");

hr = pKsTopologyInfo->get_NodeType(dwExtensionNode, &pNodeType);

CHECK_HR_RESULT(hr, "IKsTopologyInfo->get_NodeType(...)");

hr = pKsTopologyInfo->CreateNodeInstance(dwExtensionNode, IID_IUnknown, (LPVOID*)&unKnown);

CHECK_HR_RESULT(hr, "ks_topology_info->CreateNodeInstance(...)");

hr = unKnown->QueryInterface(__uuidof(IKsControl), (void**)&ks_control);

CHECK_HR_RESULT(hr, "ks_topology_info->QueryInterface(...)");

kspNode.Property.Set = xuGuid;              // XU GUID

kspNode.NodeId = (ULONG)dwExtensionNode;   // XU Node ID

kspNode.Property.Id = xuPropertyId;         // XU control ID

kspNode.Property.Flags = flags;             // Set/Get request

hr = ks_control->KsProperty((PKSPROPERTY)&kspNode, sizeof(kspNode), (PVOID)data, len, readCount);

CHECK_HR_RESULT(hr, "ks_control->KsProperty(...)");

done:

SafeRelease(&ks_control);

return hr;

}

As per our debugging in host application, In faiure condition we are calling above function and and we got error at below line in above function,

hr = ks_control->KsProperty((PKSPROPERTY)&kspNode, sizeof(kspNode), (PVOID)data, len, readCount);

How does this isHandled = CyTrue affect in this issue?

0 Likes

Regarding "isHandled = CyTrue" statement,

It was missing in two control handler and it is not present in any "CX3_USB_UVC_GET_LEN_REQ" sub-case of each handler. I have added this statement at two places and tested it but still facing the issue.

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

Hello,

I have tried to reproduce the issue at my end by adding the code snippet, shared by you, to AN75779 firmware.

Please find the attached Wireshark traces. The traces are capture without opening the host application.

From the traces, you can see that there will series of request-response transfers for all the controls (without the opening of host application) . This is expected. I couldn't find the same in the traces shared by you.

Please program this firmware and take Wireshark the traces. It should be similar to the one I shared.

If it is the same you can then open the host application and try sending  GET/SET request to particular control from the host application.

Please let me know if any queries on this

Regards,

Rashi

Regards,
Rashi
0 Likes

Hi,

Thanks for your response.

The "isHandled = CyTrue" statement was missing all "CX3_USB_UVC_GET_LEN_REQ" sub-case of each handler. I have added this statement at all "CX3_USB_UVC_GET_LEN_REQ" sub-case handler and now it seems like issue is fixed.

Thanks for your support.

0 Likes