2 USB port synchronization problem
Show older comments
Hello. I am trying to get data from a couple of Xsens MTw IMU sensors which uses Bluetooth to send data to a USB dongle and it has a code which uses livestream to have the data in Matlab. Simultaneously, I need to acquire data from a load cell which I am using Arduino Uno and send the data with USB to Matlab. The IMU sensor can stream the data with almost 40 hz and I can use a delay time in arduino code to make a synchronization between two sensors.But unfortunately, that never happens and each time one of them has delays and the data gets stuck in the buffer. Can anyone help me for solving this problem?! How can I synchronize data streaming from two usb ports in Matlab?!
Answers (1)
Walter Roberson
on 21 Nov 2018
0 votes
usb cannot be synchronized at the matlab level .
usb is a shared serial bus . it is not possible for two devices to talk on the same USB controller at the same .
With two distinct usb controllers you would have the problem that matlab is single threaded and cannot talk to two controllers at the same time. Closest would perhaps be parallel computing Toolbox with smpd and labBarrier to synchronize , but even then you have the problem that usb controllers have their own microcontroller and you never know what part of the microstate they are at.
Basically you should not try to synchronize usb by program control . Better to use a hardware strobe signal to trigger simultaneous acquisitions and then not worry that the data will not arrive at exactly the same time at matlab .
Categories
Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!