I can configure the CANopen network from Arduino IDE and successfully read live encoder updates (the encoder is connected to the MCP266 and configured through Motion Studio). I can also read the mode of operation and target velocity. However, when I send a target velocity command over CANopen, the motor does not move. I auto-tuned the velocity controller in Motion Studio, and I can successfully control the motor’s velocity from there. I am currently using the CiA-402 Write Target Velocity command, so I need help to determine what I may be missing in the CANopen configuration or CiA-402 state sequence that is preventing the motor from moving.
Hey there, @Ariana329672, and welcome to the forum. Glad to have you here.
From what you’ve described, it sounds like the CAN link to the MCP266 is working, but I’d like to narrow down the controller state before suggesting a specific sequence.
Could you share:
- The Arduino code that sends the velocity command
- Whether Motion Studio remains connected when testing from Arduino
- Any fault or warning shown in Motion Studio
Those details should show us whether this is a CiA-402 state issue, a control-source setting, or the command format.
Hi there thank you for your help! Attached to this reply is a zip file of my Arduino code, the velocity command definition lives in motor_commands.h while the main code is in can_esp32_testing.ino. For testing, I don’t have motion studio connected during CAN testing, but I tried now based on your suggestion and did not see any warning/faults show up in Motion Studio.
can_esp32_testing (2).zip (5.0 KB)
Hey there, @Ariana329672,
I think I spotted an issue in can_esp32_testing.ino. The code you provided sends NMT Start, then resets the node. After that reset the controller boots into Pre-operational, but the code continues without sending NMT Start again. It also selects Profile Velocity mode after enabling operation.
Could you retry in this order:
Reset node → wait for CANopen boot-up → NMT Start → write Profile Velocity mode → confirm mode → run the CiA‑402 enable sequence → write Target Velocity
In addition, rather than using fixed delays through the enable sequence, please read the raw hexadecimal Statusword (0x6041) after each Controlword before proceeding to the next state:
0x0006— Shutdown0x0007— Switch On0x000F— Enable Operation
That confirms whether each requested state was genuinely reached before continuing. If something breaks here, then we will have a much better idea of what is causing it.
Finally, after sending the above commands, could you please reply the serial output from the existing 0x60FF read in motor_commands.h
Those values should distinguish an NMT/state-machine problem from a rejected or incorrectly encoded velocity command.