Given a CAN bus with one master and 4 motor drivers, is there a way to measure the time between sending a command from the master (e.g. PC or PLC) and the execution of the said command (e.g. the motor moving)?
2 Answers
With a multichannel logic analyzer (or scope) you can measure the CANH/CANL signals and the signal driving the motor and calculate the difference.
See below for a very cheap one. Logic analyzers (like below) also have the possibility to interpret communication protocols like CAN, SPI, U(S)ART, I2C, MIDI, DMX etc.
This one has eight channels, if you want to measure the CANL/CANH and probably multiple signals per motor driver simultaneously, you could use two analyzers and use CANL/CANH for both analyzers (i.e. connect CANL/CANH to two signal lines from both analyzers).

- 13,867
- 18
- 69
- 139
The simplest way would be to implement the test in your design.
Since you use a CAN bus, I'm assuming you have a main board and a motor driver board.
You have two distinct delays here: the CAN bus delay, and the motor driver delay, with your question asking for the sum of them.
The CAN bus delay can be measured easily by taking the time between a message and the acknowledgement, divided by 2 (over a few messages to have a statistically significant value, see bottom note).
If you have a position or speed sensor on your motor, you could send back a "motor start acknowledgement" message back from your driver board to your main board. Then, send your command and wait for the CAN interrupt. The time you just measured is:
CAN bus delay + motor driver delay + CAN bus delay.
Since you figured out your CAN bus delay earlier, you can work out your motor delay.
Another way to detect a running motor would be to monitor the motor current.
This also gives you the opportunity to add software debugging features, and inform the user on malfunction equipment with messages like "Error 64: Non-responding motor: Motor #3. Motor may be stuck on not wired correctly."
Now to be fair, if your motor board is simply a CAN-connected driver, the CAN bus delay is the only useful value and the motor driver delay is negligible.
Note about delay:
Since you use a communication bus, you must accept to have some variance in the delay. For example, you could send your command when another device on the bus just started transmitting, or have a transmission error and need to start over. in most use cases, it won't matter, but if it does, you may need to rethink your architecture.

- 1,676
- 3
- 17
- 23

- 1,698
- 8
- 16