- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dheeraj-san,
Thank you for your reply.
We are considering using a stopwatch, but do you know how much delay is reasonable?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The OS we are using is Windows.
Measure and consider the optimal waiting time.
Thank you for your support.