1
\$\begingroup\$

USB works similar to the Master and Slave architecture. There is an Host which is manage the bus as like a Master. There can be various "devices" which is managed by host like slaves. I wonder that whether USB can be used in real-time motion control or not. For a real-time job, you need an deterministic interface. USB working principle is similar to the Master & Slave architecture. So this means that USB completely deterministic solution, right? At most how much cycle time can be reached by USB ? What is the drawback of USB for real-time motion control?


Say a system consist of one Host and 16-devices. Devices can be servo-drives and a few sensors (encoders, gyros etc.). For instance, I want to send motion commands to these servo-drives and receive back sensors feedback through the same USB interface. I probably would like to see sub miliseconds cycle-time such as 500 uS (2kHz), 250 uS (4kHz). USB interface can handle the these requirements? I concern about the delay of USB. Is it deterministic or non-deterministic?

\$\endgroup\$
  • \$\begingroup\$ what is the master? some other RTOS or windows? \$\endgroup\$ – JonRB Sep 28 at 11:05
  • \$\begingroup\$ Yeah, a PC OS will be much less "real-time" than USB... \$\endgroup\$ – peufeu Sep 28 at 11:21
  • \$\begingroup\$ @JonRB, Probably Master or Host should be a Real-Time OS. Not windows. Any suggestion for this? \$\endgroup\$ – doner_t Sep 28 at 11:29
  • \$\begingroup\$ @peufeu, Definetely correct. It should not be PC, but an embedded one. Right? How about USB usage in embedded environment? Is USB sufficiently robust for temperature, vibration and EMI/EMC effects? \$\endgroup\$ – doner_t Sep 28 at 11:32
  • \$\begingroup\$ Please don't expand the scope of your question in the comments. Try and restrict to one particular issue. The other topics may make good separate questions. You'll need numbers. \$\endgroup\$ – Transistor Sep 28 at 11:35
3
\$\begingroup\$

The concept of "real time" is a stretchable thing. If your controlled object is, say, a metallurgical oven, then, depending on the size of it the real control time may be from seconds to minutes or even hours. So you need to define more clearly what kind of sampling rate is sufficient to make a robust and stable control for your object. To determine which time-cycle do you need, you need careful analysis of dynamics and stability of your control loop.

Now, the question is good, but it needs to be re-formulated. It should be something like, what is the overall latency of USB system, the time from issuing an API call from some software control algorithm, to actual change in some GPIO pins on the side of USB-connected device. The chain of events is long, it goes through API, several layers of drivers, filling various TRBs structures in main memory, then the hardware gets involved, ringing the bell register initiating DMA access by xHCI controller and streaming data across several elasticity buffers into actual USB PHY, then waiting for protocol response. And then something similar happens inside the USB device itself before actually toggling some GPIO pin. I don't know the answer to this question. But it is quite clear that the desirable sub-ms loop latency is impossible.

\$\endgroup\$
0
\$\begingroup\$

I see your question is also tagged EtherCAT. Why not just use the EtherCAT protocol with an Ethernet adapter interface to your OS? You can easily achieve sub-millisecond communications

\$\endgroup\$
  • \$\begingroup\$ Did you previously validate/test the EtherCAT protocol in your motion-control system? I think a third-party software-stack is needed for Master side. But USB-based products are easily found in the market. \$\endgroup\$ – doner_t Sep 29 at 17:27
  • \$\begingroup\$ I don't follow your question. What do you mean by previously validate/test EtherCAT in my motion-control system? Typically a third-party software is needed to implement an EtherCAT master but their are also open source alternatives. If you use USB you will need some application to control the motor. \$\endgroup\$ – Jon Oct 1 at 0:19
  • \$\begingroup\$ I meant that whether you test/validate the EtherCAT interface in cold and high temperature or did you see the performance of EtherCAT under vibration? \$\endgroup\$ – doner_t Oct 6 at 20:10
  • \$\begingroup\$ EtherCAT is used in rugged industrial environments. I'm sure there are controllers and drives that have specifications for certain temperature and vibration ranges. \$\endgroup\$ – Jon Oct 7 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.