phoenix-rtos / phoenix-rtos-hostutils

Phoenix-RTOS supporting daemon
BSD 3-Clause "New" or "Revised" License
1 stars 5 forks source link

psu: hangs while sending the last packet #25

Closed HBuczynski closed 3 years ago

HBuczynski commented 3 years ago

JIRA: RTOS-70

Description

If the last packet's size is not equal to BUF_SIZE, the hid_write sometimes returns -1. Looking at wireshark logs, the device returns log URB Status: No such file or directory (-ENOENT)

I haven't found any information about packet's data alignment in imxrt106x Reference Manual. There is only note that there is allowed max 1024 bytes data per report.

I know that it is not the best way for solving this issue, but I haven't found the better one.

Motivation and Context

Types of changes

How Has This Been Tested?

Checklist:

Special treatment

nalajcie commented 3 years ago

FYI, the psu hangs here: image

HBuczynski commented 3 years ago

I have analyzed the descriptors from HID device using wireshark. It occurred that Report 2 which is responsible for sending data has Report Size = 128 (bits) and Report Count = 64. So that the minimum Report Size should be multiplicity of 128 bits. The more information about HID protocol can be found https://usb.org/sites/default/files/hut1_2.pdf in chapter 4.6

The image below shows reports description: image

Aligning size to 0x10 solves the problem both on imxrt106x and imx6ull.