cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

New Contributor

Hi,

i experience a high CPU load when using the CyUsbSerial Lib.

The CPU load goes up to 30% on my embedded device after connecting a callback with the function CySetEventNotification(). The callback itself does not get invoked and therefore should not produce any CPU Load in idle.

My setup is:

- CY7C65215

- linux os with libusb 1.0.9

- latest cyusbserial sdk from the website

I tracked down the problem to the cyusbserial library source code cymisc.c in line 239. In this line the libusb function libusb_handle_events_timeout() is used with an 50us timeout.

I replaced the function with the blocking call libusb_handle_events_completed() and the CPU load dropped to nearly 0%.

As far as i could test, this change works perfectly fine.

Is there any downside of using the blocking call instead of the timeout one?

Could cypress provide an official fix for this?

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello,

Using libusb_handle_events_completed() in place of libusb_handle_events_timeout() will not affect the code flow and will avoid race conditions.

The timeout in libusb_handle_events_completed() is hardcoded at 60 seconds. To have finer control over the timeout you can use libusb_handle_events_timeout_completed().

Best Regards,

Yatheesh

View solution in original post

0 Likes
Reply
1 Reply
Moderator
Moderator

Hello,

Using libusb_handle_events_completed() in place of libusb_handle_events_timeout() will not affect the code flow and will avoid race conditions.

The timeout in libusb_handle_events_completed() is hardcoded at 60 seconds. To have finer control over the timeout you can use libusb_handle_events_timeout_completed().

Best Regards,

Yatheesh

View solution in original post

0 Likes
Reply