CiA 402 Motion Control Example For MAXPOS Drive - Simple Robot
CiA 402 Motion Control Example For MAXPOS Drive - Simple Robot
CiA 402 Motion Control Example For MAXPOS Drive - Simple Robot
24
Motion control may be the most interested application of EtherCAT. In
PiCAT Xenomai 3…
this post I will explain how to use PiCAT to control a standard CoE
DS402 motor driver
Xenomai for Ras… 67
Raspberry pi 4 su… 17
PiCAT schematic… 4
Distributed Clock … 43
EtherCAT Master … 39
Raspberry Pi Eth… 57
EtherCAT Master … 11
EtherCAT
Raspberry pi 2,3 … 27
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 1/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
device, CiA 402 for motion devices (include servo drives, inverters,
Simple Robot stepper motor drivers,...).
...build
CoE
yourself
-
robot simply
CANopen over
with …
EtherCAT is the way to
implement CANopen profiles specification for EtherCAT. By CoE, we
Sidebar can utilize RASPBERRY-PI2&3
Home RASPBERRY-PI1&0 all well standardized CANopen protocols
RPI-EtherCAT FACEBOOKon high speed ,
high density EtherCAT network. With CoE, limitations of CAN bus like
PiCAT4 - The real… 28 low bit rate, short frame length are avoided.
CiA DS402 is a CANopen profile for motion devices or motor drivers.
In this motion profile, a set of standard objects, operation modes and
Teardown and Recovery… finite state machine (FSM) are predefined. And since everything is
standardized, Master control code for one driver type can be utilized to
PiCAT4 - Realtim… 14 other types with minimal modifications.
EtherCAT Master … 11 Several operation modes of driver with CiA 402 profile compatible. The
value follow by mode name is code which Master would assign for
'Mode of operation' object:
EtherCAT
Profile position mode: 1
Velocity mode (frequency converter): 2
Raspberry pi 2,3 … 27 Profile velocity mode: 3
Torque profile mode: 4
Raspberry pi 0,1 - Deplo…
Homing mode: 6
Interpolated position mode: 7
Cyclic synchronous position mode (CSP): 8
Raspberry pi 2,3 … 8 Cyclic synchronous velocity mode (CSV): 9
Cyclic synchronous torque mode (CST): 10
Raspberry pi 0,1 … 2
Any EtherCAT CiA 402 compatible driver should support at least one
mode from 8 to 10. Among these operation modes, CSP is most
popular found in EtherCAT drivers, this mode is useful for positioning
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 2/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
PiCAT4 - Realtim… 14
PiCAT Xenomai 3… 24
Raspberry pi 4 su… 17
PiCAT schematic… 4
Distributed Clock … 43
EtherCAT Master … 39
Raspberry Pi Eth… 57
[https://1.bp.blogspot.com/-
EtherCAT Master … 11
M3lIylaXfaw/XF1EdbYPQiI/AAAAAAAAA70/io6Za9gehb
QgJQHejM9a-Renn1p8A0gGgCLcBGAs/s1600/CiA402-
EtherCAT
StateMachine.PNG]
In this figure, rectangle blocks are driver states and yellow highlighted
Raspberry pi 2,3 … 27
numbers are state transition. Driver state is indicated by Statusword
object, in order to change from one state to another state, Master
Raspberry pi 0,1 - Deplo… should send a corresponded Controlword value.
Raspberry pi 2,3 … 8
Raspberry pi 0,1 … 2
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 3/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
PiCAT4 - Realtim… 14
PiCAT Xenomai 3… 24
[https://4.bp.blogspot.com/-
Raspberry pi 4 su… 17
aAva7vuhve8/XF1F8B9GUVI/AAAAAAAAA8A/Hb8zQ15
XbqkKBweSixF0wjWxTj5GWwFWACLcBGAs/s1600/FS
CiA 402 Motion c… 29
M-in-out.PNG]
PiCAT schematic… 4
SERVO-ON: is procedure that Master should read Statusword from
driver and send corresponded Controlword (command) to driver to
Distributed Clock … 43 make it change to final state, Operation Enable. The common SERVO-
ON path in CiA 402 state machine is: (1) -> (2) -> (3) -> (4) or (13) ->
39
(14) -> (15) -> (2) -> (3) -> (4)
EtherCAT Master …
Raspberry pi 0,1 - Deplo… CiA 402 motion control example for MAXPOS
drive
Raspberry pi 2,3 … 8
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 4/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
PiCAT4 - Realtim… 14
PiCAT Xenomai 3… 24
Raspberry pi 4 su… 17
PiCAT schematic… 4
Distributed Clock … 43
[https://2.bp.blogspot.com/-rWTuQ_ppnS0/XF17etYj7GI/AAAAAAAAA8U/-
NgOrjuS7XAGg25HOOMdOGGrVT3nNN5_gCLcBGAs/s1600/20190206_234
EtherCAT Master … 39 301.jpg]
EtherCAT
Raspberry pi 2,3 … 27
Raspberry pi 2,3 … 8
Raspberry pi 0,1 … 2
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 5/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
PiCAT4 - Realtim… 14
PiCAT Xenomai 3… 24
Raspberry pi 4 su… 17
PiCAT schematic… 4
EtherCAT
Raspberry pi 2,3 … 27
Raspberry pi 2,3 … 8
Raspberry pi 0,1 … 2
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 6/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
PiCAT4 - Realtim… 14
PiCAT Xenomai 3… 24
Raspberry pi 4 su… 17
PiCAT schematic… 4
Distributed Clock … 43
[https://4.bp.blogspot.com/-
EtherCAT Master … 39 vc6EY0aoXGI/XF2AofGORoI/AAAAAAAAA88/YSd2Q_vQulkoJ_M6CHyInG
Xl1pCDRjs5QCLcBGAs/s1600/PDO-remapping.PNG]
2-DOF Robot con… 14
Raspberry Pi Eth… 57
EtherCAT Master … 11
EtherCAT
Raspberry pi 2,3 … 27
Raspberry pi 2,3 … 8
[https://4.bp.blogspot.com/-
Raspberry pi 0,1 … 2
DFqthehyRSk/XF2AVc6DqcI/AAAAAAAAA8w/vadYw9UDHhcBjIArfEKHV
VGYYYP8_ZXdQCLcBGAs/s1600/MAXPOS-default-PDO.PNG]
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 7/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
For other operation mode (e.g CST, CSV) user have to select other
Simple Robot suitable objects and do PDO remapping. In some cases, user should
...build yourself robot simply with…
do mapping for each individual entry.
Raspberry pi 4 su… 17 Was eagerly waiting for this post from you.Its been a long time.
Nevertheless, Thank you. Hope to get some details on using ROS service
for the same.
CiA 402 Motion c… 29 Reply
PiCAT schematic… 4
Anonymous February 18, 2019 at 8:46 PM
Reply
EtherCAT Master … 39
EtherCAT Master … 11
Replies
Reply
Raspberry pi 0,1 - Deplo…
Replies
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 8/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
PiCAT4 - Realtim… 14
Anonymous April 5, 2019 at 3:14 PM
24 Hi Ho Tam,
PiCAT Xenomai 3…
I followed all of your tutorials and there are really great to get knowledge
67 about the Ethercat working.
Xenomai for Ras…
Currently I have few questions regarding SOEM.
Raspberry pi 4 su… 17
In my project, I am using TMS570LC4357 Launchpad which has inbuilt
EMAC module and would like to use it as an etherCAT master. As an
29 etherCAT slave, I am using LAN9252 from Microchip.
CiA 402 Motion c…
Since, I am completely new to etherCAT, I do not know where to start i.e.
4 how to use the ethercat SOEM library and what do i need to edit in the code
PiCAT schematic…
etc.
43 Could you point me in the right direction to get it start working? Like what
Distributed Clock …
are the steps do i need to do initially?
Reply
EtherCAT Master … 39
Replies
2-DOF Robot con… 14
Ho Tam April 7, 2019 at 3:48 PM
This will be a hard work, in order to port SOEM to bare metal
Raspberry Pi Eth… 57 platform you should do 2 important jobs:
- Network driver, mostly you have to implement 3 functions:
initialization, raw sending and raw receiving
EtherCAT Master … 11 - Time management, you have to provide system time and
modify osal.c file, replace linux time functions (like clock_gettime
) by your functions.
EtherCAT If you are new to SOEM, I suggest you first get familiar with it in
Linux environment before porting to new system.
Raspberry pi 2,3 … 27
First of all great work Ho Tam! Really like how you explain things
Raspberry pi 2,3 … 8 and use affordable hardware and opensource software to get
industry like performance.
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 9/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
Reply
Simple Robot ...build yourself robot simply with…
Sidebar KSolberg
Home RASPBERRY-PI1&0 July 7, 2019 at 4:16
RASPBERRY-PI2&3 PM
RPI-EtherCAT FACEBOOK
Are you working with G-Code? My 3d printer has ethercat servos in all axis,
PiCAT4 - The real… 28 including the extruder.(Copley plus and Elmo gold) I'm using step/direction
now, but would love to use ethercat. Unfortunately existing solutions are
expensive.
Teardown and Recovery… Reply
Raspberry pi 4 su… 17
Burak ÖZLER November 16, 2019 at 4:08 PM
Hi Ho TAM,
CiA 402 Motion c… 29
I'm following your work it's great.. For CNC you don't need to
write complete G_code interpreter. You can use Linux CNC and
PiCAT schematic… 4
write a HAL file for it.
Linux CNC already has a Ethercat HAL from rt-labs.. Bu they
don't have SOEM HAL, I think SOEM is much more lighter and
Distributed Clock … 43
can be use much more widely with Linux CNC..
EtherCAT Reply
Raspberry pi 2,3 … 27
Anonymous July 26, 2019 at 1:31 PM
Raspberry pi 0,1 - Deplo… K Solberg,
Did you check Codesys? The provide an EtherCAT master for a raspberry
Raspberry pi 2,3 … 8 pi or beaglebone for ~50EUR. You can add CNC module as well to control
the 3d printer.
2 Reply
Raspberry pi 0,1 …
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 10/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
14 Reply
PiCAT4 - Realtim…
Replies
PiCAT Xenomai 3… 24
Ho Tam February 21, 2020 at 8:10 AM
67 I am quite sure that it will work for any CiA402 compatible drive.
Xenomai for Ras…
At least I have tested with Maxon, Elmo, Servotronix, Yaskawa
and Neuromeka Drive
Raspberry pi 4 su… 17
Reply
Raspberry pi 0,1 … 2
Minmin July 29, 2020 at 11:11 PM
Hello!
I've tried your Xenomai 3 with Raspberry pi 4 and tested the soem codes
with XMC4800 that shows to work fine. Now, I modified your
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 11/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
MAXPOS_CSP code for my EPOS4 controller and tried to control one
motor (one controller only, unlike your application).
Simple Robot ...build yourself robot simply with…
Now, I am facing some interesting results.
The codes seem to function without re-mapping, but the actual position and
Sidebar Home RASPBERRY-PI1&0 RASPBERRY-PI2&3
target position is extremelyRPI-EtherCAT
off. There seems FACEBOOK
to be a large difference
between the commands (with a ratio of approximately 60). I am now setting
the sine_amp = 11500000000, but still not seeing my motor moving.
PiCAT4 - The real… 28
The slave seems to be in state 0x02 with no AL error. but the status word
runs crazy with various numbers (for example, one sample shows 0xB024
and the next shows 0xA334).
Teardown and Recovery…
On the other hand, if I try to remap PDO, things just doesn't work (with
RxPDO assignment error).
PiCAT4 - Realtim… 14
Got any idea what is happening? I've checked the Index with EPOS studio
and they should be identical to your code. If I change the subindex to 00, it
PiCAT Xenomai 3… 24
seems to work, but
Reply
Xenomai for Ras… 67
Replies
Raspberry pi 4 su… 17
Minmin July 29, 2020 at 11:14 PM
but later shows expectedWKC = 0
CiA 402 Motion c… 29
EtherCAT Master … 39
Minmin July 30, 2020 at 2:09 PM
I see. Is there any parameter in the codes that adjusts the output
2-DOF Robot con… 14 positions unit? I don't seem to find any, but please correct me if
I'm wrong.
Thank you again for your feedback and nice work.
Raspberry Pi Eth… 57
EtherCAT Master … 11
Minmin July 30, 2020 at 2:13 PM
One more thing. I see in the object directory that the index are
EtherCAT identical to your settings. What would happen if I don't remap?
Isn't the index identical, and I don't need to remap?
Raspberry pi 2,3 … 27
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 12/13
9/27/23, 2:32 PM CiA 402 Motion control example for MAXPOS drive | Simple Robot
Ho Tam July 31, 2020 at 8:07 AM
Simple Robot ...build yourselfTalk about MAXPOS (the one I had), Maxon design several
robot simply with…
PDO groups like CSP CSV CST,...Depending on your desired
operation mode you should select and map proper groups. The
default PDO mapping of MAXPOS is for CSP mode only. When
Sidebar Home RASPBERRY-PI1&0 RASPBERRY-PI2&3 RPI-EtherCAT FACEBOOK
you try to remap, you must change pdo information in pdo_def.h
and PDO index in ecat_init function.
PiCAT4 - The real… 28 One important note, you should check your driver firmware
revision and then select matched pdo information in ESI file.
Different firmware revision will have different pdo information.
Teardown and Recovery… Good luck!
PiCAT4 - Realtim… 14
Minmin August 4, 2020 at 4:55 PM
An update from my side. I've checked the mapping, and it
PiCAT Xenomai 3… 24 should be correct. For Epos4, we don't need to remap but
command directly the specific object for different modes (such
as CSP...etc). Therefore, I can use ec_SDOwrite to command
Xenomai for Ras… 67 the controller to operate in each different mode and move the
motor. But I'm not sure did the rest of the codes work fine. For
example, the functions such as ec_statecheck works fine, and
Raspberry pi 4 su… 17 the ec_slave[i].state are able to map to the state. Also, your
code ServoOn_GetCtrlWrd is able to work and command the
controller to operation mode. However, I cannot use
CiA 402 Motion c… 29 maxpos_drove_pt[i].ptOutParam->TargetPosition to command
the position, or to use maxpos_drove_pt[i].ptOutParam-
>ModeOfOperation to modify the mode. How should I explain
PiCAT schematic… 4 this result?
Reply
Distributed Clock … 43
Raspberry Pi Eth… 57
EtherCAT Master … 11
EtherCAT
Raspberry pi 2,3 … 27
Raspberry pi 2,3 … 8
Raspberry pi 0,1 … 2
Powered by Blogger.
www.simplerobot.net/2019/02/cia-402-motion-control-example-for.html 13/13