Hello,
I’m using the Opal Kelly XEM6010 to send commands to/from some custom hardware that my team works with. I wrote the code to interface with the Opal Kelly in Matlab, using their calllib function to run Opal Kelly API functions. It works well enough but I’ve noticed that the throughput is extremely low. When I did a code analysis in Matlab I found that 99.9% of the execution time is tied up in the Opal Kelly API call, even though the amount of data that I’m sending in each call is pretty low - about 9 16-bit words. I find that each time I run calllib to send a new chunk of data, it takes about 3ms to complete the API call.
Anyway, has anyone else observed this problem, and if so what was the solution? Here’s some ideas I’ve been kicking around but I can’t figure out how to confirm/fix the issue. Any help whatsoever would be appreciated.
- Maybe the Opal Kelly API is waiting to send the data (and the API call is not returning) until the USB2 frame is complete. As I understand it, USB2 frames have a frequency on the order of 1kHz, so this would explain a good deal of the delay.
- Matlab’s calllib is just really inefficient and introduces ~3ms overhead even once the library is loaded?