CY7C65215 CyUsbSerial library high CPU load

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

cross mob
FlGe_2355111
Level 1
Level 1

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
1 Solution
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

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
1 Reply