PSoC5LP AN73503 USBBootloaderHost_VC2015.zip

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

cross mob
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Hi,

We are considering USB HID Bootloader for PSoC5LP.

Browse AN73503 and use USBBootloaderHost_VC2015.zip.

However, sometimes writing fails.
The USB HID bootloader host app stops halfway due to error code 0x04 (data is not in the correct format).

When analyzing the USB HID host application software,

1. Send data to the device
2. Query device for response

The above 1 and 2 are repeated.

Since 1 and 2 are executed in succession,

We thought that if I made an inquiry without being able to return a response, We would not be able to read the response correctly.

Therefore, when a wait (10ms) is inserted between 1 and 2, it is operating normally. Write failures no longer occur.

As a method, wait time of 10 milliseconds is inserted with System.Threading.Thread.Sleep (10) before using ReadInput () of CyHidDevice class.

Is this workaround correct?
Or do you know any other good workarounds?

Regards,

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

The best way to find out an estimate of how long a function takes to return a response is to use StopWatch class in C#. Based on this, you can implement the Sleep. That way you aren't slowing down the execution more than necessary.

Workaround is correct, no worries

Regards,

Dheeraj

View solution in original post

0 Likes
4 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

The best way to find out an estimate of how long a function takes to return a response is to use StopWatch class in C#. Based on this, you can implement the Sleep. That way you aren't slowing down the execution more than necessary.

Workaround is correct, no worries

Regards,

Dheeraj

0 Likes
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Dheeraj-san,

Thank you for your reply.

We are considering using a stopwatch, but do you know how much delay is reasonable?

Regards,

0 Likes

The ReadInput() should actually wait until the InputReport is received. But looks like it doesn't wait as specified in the reference guide. There is no WaitForXfer function in CyHidClass like in the EndPoint class hierarchy to signal that the data is ready. The WriteOutput() function might have variables times and hence that is why I recommended using the StopWatch class to calculate a reasonable response time.

Which operating system are you using?

Regards,

Dheeraj

0 Likes
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

The OS we are using is Windows.
Measure and consider the optimal waiting time.
Thank you for your support.

0 Likes