USBFS HID UPS

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

cross mob
lock attach
Attachments are accessible only for community members.
LuDi_2288466
Level 2
Level 2
10 replies posted 5 replies posted 5 questions asked

Hi,

I use FreeSoC2 Development Board, SparkFun’s take on the PSoC5LP ARM Cortex with two processors onboard: a CY8C5868LTI-LP039 and a CY8C5888AXI-LP096. I want configure USB Full-Speed (USBFS) component as HID Uninterruptable Power Supply Interface (UPS).

I have attached a simply project where i have configure hid descriptor in following mode :

<?xml version="1.0" encoding="utf-16"?>

<HID_Report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Report_Name="Batteria UPS Test">

  <Items>

    <HID_Item Type="USAGE_PAGE" Code="4" Size="1" Value="132" Desc="(Power Device)" />

    <HID_Item Type="USAGE" Code="8" Size="1" Value="4" Desc="(UPS)" />

    <HID_Item Type="COLLECTION" Code="160" Size="1" Value="1" Desc="(Application)" />

    <HID_Item Type="USAGE" Code="8" Size="1" Value="31" Desc="(FlowID)" />

    <HID_Item Type="COLLECTION" Code="160" Size="1" Value="0" Desc="(Physical)" />

    <HID_Item Type="REPORT_ID" Code="132" Size="1" Value="1" Desc="(1)" />

    <HID_Item Type="USAGE" Code="8" Size="1" Value="53" Desc="(PercentLoad)" />

    <HID_Item Type="USAGE_PAGE" Code="4" Size="1" Value="132" Desc="(Power Device)" />

    <HID_Item Type="REPORT_SIZE" Code="116" Size="1" Value="8" Desc="(8)" />

    <HID_Item Type="REPORT_COUNT" Code="148" Size="1" Value="3" Desc="(3)" />

    <HID_Item Type="LOGICAL_MINIMUM" Code="20" Size="1" Value="0" Desc="(0)" />

    <HID_Item Type="LOGICAL_MAXIMUM" Code="36" Size="2" Value="255" Desc="(255)" />

    <HID_Item Type="INPUT" Code="128" Size="1" Value="0" Desc="()" />

    <HID_Item Type="END_COLLECTION" Code="192" Size="0" Value="0" Desc="" />

    <HID_Item Type="END_COLLECTION" Code="192" Size="0" Value="0" Desc="" />

  </Items>

</HID_Report>

But when i read the report with Usb control center Cypress's tool i read all zeros. In the firmware i load and enable the specified USB data endpoint for an IN data transfer, in particular i want to send a specifical Percent Load. But it doesn't work. Why?

Thanks in advance for any replies.

Lucia

0 Likes
1 Solution
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

I have captured USB transfers with WIRESHARK and confirmed that the interrupt in transfers are sent every 0.5sec and its content is alternately changed [00 02 00] and [00 01 01]

GS004272.png

GS004273.png

GS004274.png

It was ensured that  the interrupt in transfers are sent as described in the firmware.

Regards,

Noriaki

View solution in original post

0 Likes
11 Replies
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

Hello ,

Which version of USB control center are you using.

Thanks,

Ankita

0 Likes

Hi,

I use the following version of USB control center :

pastedImage_0.png

Thanks,

Lucia

0 Likes

Hi,

Please check this KBA:

Control Center for HID applications

It says that in order to see such HID transfer data, you need to change the device class to vendor-specific and bind it to CyUSB.sys driver.

CyUSB.sys driver has not been tested with Windows 10.

If you can check with USB log analyzer, that can give more info regarding the issue.

Thanks,

Ankita

0 Likes

Hi,

Thanks for your reply, but I don't undestand how to change the device class to vendor-specific and bind it to CyUSB.sys driver. Can you explain how to do this, please?

Thanks,

Lucia

0 Likes

I found Microsoft has a tool to capture the USB transactions at following URL.

Capture and view USB traces with Microsoft Message Analyzer - Windows drivers | Microsoft Docs

As the result of capturing it was found interrupt transfers are occurred every 0.5sec.

GS004271.png

But I cannot see the TransferData because the data is not available.

Can anyone try to use this tool?

Regards,

Noriaki

0 Likes
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

I have captured USB transfers with WIRESHARK and confirmed that the interrupt in transfers are sent every 0.5sec and its content is alternately changed [00 02 00] and [00 01 01]

GS004272.png

GS004273.png

GS004274.png

It was ensured that  the interrupt in transfers are sent as described in the firmware.

Regards,

Noriaki

0 Likes

Thanks for your replies!

0 Likes

I found a problem in your code.

You declared the "REPORT ID" element in the report descriptor.  When a "REPORT ID" is contained in the report descriptor, the first byte of the REPORT response must have the "REPORT ID"

Increase UPS_DATA_LEN from 3 to 4

Initialize Ups_Data with four 0s

In the ups_task() store 1 to Ups_Data[0] as the REPORT ID

Store other data to Ups_Data[1] to Ups_Data[3]

There is another solution remove the "REPORT ID" element from the report descriptor.  In this case the host request a report with REPORT ID is 0 and the REPORT ID is not required in the response data..

Regards,

Noriaki

0 Likes

Thanks for your reply!

0 Likes
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

Could you try

while (!(USBFS_1_GetEPState(UPS_ENDPOINT) & USBFS_1_IN_BUFFER_EMPTY)) {}

instead of

while(!USBFS_1_bGetEPAckState(1)){};

?

GS004270.png

0 Likes

It still doesn't work . How I can resolve this problem?

Thanks,

Lucia

0 Likes