Skip to content

Commit

Permalink
Merge branch 'master' of github.com:paulscherrerinstitute/ecmccfg
Browse files Browse the repository at this point in the history
  • Loading branch information
anderssandstrom committed Dec 4, 2024
2 parents f3f3f0b + 560bb62 commit 7b08834
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

require ecmccfg "ENG_MODE=1,MASTER_ID=1"

# 0:7 - EL7041 1Ch Stepper
# EL7041 1Ch Stepper
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=14,HW_DESC=EL7041-0052"
${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1500, I_STDBY_MA=1000, U_NOM_MV=48000, R_COIL_MOHM=1230'"
epicsEnvSet(DRV_SID,${ECMC_EC_SLAVE_NUM})

# 0:2 - EL5042 2Ch BiSS-C Encoder, RLS-LA11
# EL5042 2Ch BiSS-C Encoder, RLS-LA11
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=9,HW_DESC=EL5042"
${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1"
${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=2"
Expand Down
29 changes: 0 additions & 29 deletions hardware/Beckhoff_7XXX/ecmcEX72XX_CSV.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,6 @@ ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${EC
#- Conclusion: Need to contact Beckhoff. Probably firmware bug.
ecmcConfigOrDie "Cfg.EcSetDelayECOkAtStartup(${ECMC_EC_STARTUP_DELAY=4000})"

# ethercat -p22 pdos
# SM0: PhysAddr 0x1000, DefaultSize 256, ControlRegister 0x26, Enable 1
# SM1: PhysAddr 0x1100, DefaultSize 256, ControlRegister 0x22, Enable 1

# SM2: PhysAddr 0x1200, DefaultSize 12, ControlRegister 0x24, Enable 1
# RxPDO 0x1610 "DRV RxPDO-Map Controlword Ch.1"
# PDO entry 0x7010:01, 16 bit, "Controlword"
# RxPDO 0x1611 "DRV RxPDO-Map Target position Ch.1"
# PDO entry 0x7010:05, 32 bit, "Target position"
# RxPDO 0x1650 "DRV RxPDO-Map Controlword Ch.2"
# PDO entry 0x7110:01, 16 bit, "Controlword"
# RxPDO 0x1651 "DRV RxPDO-Map Target position Ch.2"
# PDO entry 0x7110:05, 32 bit, "Target position"

# SM3: PhysAddr 0x1600, DefaultSize 20, ControlRegister 0x20, Enable 1
# TxPDO 0x1a00 "FB TxPDO-Map Position Ch.1"
# PDO entry 0x6000:11, 32 bit, "Position"
# TxPDO 0x1a10 "DRV TxPDO-Map Statusword Ch.1"
# PDO entry 0x6010:01, 16 bit, "Statusword"
# TxPDO 0x1a11 "DRV TxPDO-Map Following error actual value Ch.1"
# PDO entry 0x6010:06, 32 bit, "Following error actual value"

# TxPDO 0x1a40 "FB TxPDO-Map Position Ch.2"
# PDO entry 0x6100:11, 32 bit, "Position"
# TxPDO 0x1a50 "DRV TxPDO-Map Statusword Ch.2"
# PDO entry 0x6110:01, 16 bit, "Statusword"
# TxPDO 0x1a51 "DRV TxPDO-Map Following error actual value Ch.2"
# PDO entry 0x6110:06, 32 bit, "Following error actual value"

#- Default panel
epicsEnvSet("ECMC_HW_PANEL" "Ex72x1")

16 changes: 2 additions & 14 deletions hugo/content/manual/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ Blindly restarting the IOC, with only partially working EtherCAT hardware, will
The startup script has several steps:

1. `require` [ecmccfg](#require-ecmccfg)
1. [configure](#slave-configuration) the slaves on the EtherCAT bus
2. [configure](#slave-configuration) the slaves on the EtherCAT bus
- additional configuration
- adding a physical motor axis
- adding a virtual motor axis
- adding synchronization
- loading a PLC from file
1. [apply](#apply-the-configuration) the configuration
1. [go active](#go-active)

#### require ecmccfg
```bash
Expand Down Expand Up @@ -70,7 +68,7 @@ This behaviour can be modified by arguments.
```bash
# slave 8 {EL7037}, configure slave using applyComponent.cmd from ecmccomp module with optional SLAVE_ID.
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7037, SLAVE_ID=8"
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1000, I_STDBY_MA=500, U_NOM_MV=48000, R_COIL_MOHM=1230'"
${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1000, I_STDBY_MA=500, U_NOM_MV=48000, R_COIL_MOHM=1230'"
# slave 9 {EL7037}, addSlave, with immediate call off applySlaveConfig
# slave with global configuration
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7037"
Expand All @@ -81,11 +79,6 @@ This behaviour can be modified by arguments.
${SCRIPTEXEC} ${ecmccfg_DIR}applySlaveConfig.cmd, "LOCAL_CONFIG=${CFG_ROOT}AM8211_AGIR.cfg"
```

#### apply the configuration
The configured process image is applied to the master
```bash
${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cmd
```

##### additional configuration
Optionally, manual modifications can be made to the default configuration.
Expand Down Expand Up @@ -150,8 +143,3 @@ ECMC PLCs can be loaded from classical PLC files, from pure yaml files or from a
{{% notice tip %}}
See [plc cfg](../plc_cfg/best_practice/) for more information.
{{% /notice %}}

#### go active
```bash
${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd
```
22 changes: 11 additions & 11 deletions qt/ecmcAxisExpert_v2.ui
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,7 @@
</rect>
</property>
<property name="macro">
<string notr="true">ENC_ID=05,SYS=$(SYS),Axis=$(Axis),IOC=$(IOC)</string>
<string notr="true">ENC_ID=04,SYS=$(SYS),Axis=$(Axis),IOC=$(IOC)</string>
</property>
<property name="visibility">
<enum>caFrame::Calc</enum>
Expand Down Expand Up @@ -4016,9 +4016,9 @@
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<y>90</y>
<width>336</width>
<height>156</height>
<height>151</height>
</rect>
</property>
<property name="title">
Expand Down Expand Up @@ -4308,7 +4308,7 @@
</size>
</property>
<property name="text">
<string>Mon limit home:</string>
<string>Mon home:</string>
</property>
</widget>
<widget class="caLineEdit" name="calineedit_58">
Expand Down Expand Up @@ -4397,7 +4397,7 @@
<x>10</x>
<y>10</y>
<width>215</width>
<height>65</height>
<height>76</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -4425,7 +4425,7 @@
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<y>25</y>
<width>100</width>
<height>18</height>
</rect>
Expand All @@ -4447,7 +4447,7 @@
<property name="geometry">
<rect>
<x>5</x>
<y>20</y>
<y>25</y>
<width>80</width>
<height>18</height>
</rect>
Expand All @@ -4460,7 +4460,7 @@
<property name="geometry">
<rect>
<x>5</x>
<y>40</y>
<y>47</y>
<width>80</width>
<height>18</height>
</rect>
Expand All @@ -4473,7 +4473,7 @@
<property name="geometry">
<rect>
<x>195</x>
<y>10</y>
<y>25</y>
<width>18</width>
<height>18</height>
</rect>
Expand All @@ -4492,7 +4492,7 @@
<property name="geometry">
<rect>
<x>91</x>
<y>41</y>
<y>48</y>
<width>65</width>
<height>18</height>
</rect>
Expand All @@ -4505,7 +4505,7 @@
<property name="geometry">
<rect>
<x>158</x>
<y>43</y>
<y>50</y>
<width>32</width>
<height>18</height>
</rect>
Expand Down
4 changes: 4 additions & 0 deletions release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 9.6.6
* Add wrapper to ecmccomp/applyComponent.cmd (automatically requires ecmccomp)
* Cleanup in PSI best practices.

# 9.6.5
* Unset PLC_MACROS after loadPLCFile.cmd and loadPLCLib.cmd
* Minor updates to manual
Expand Down
27 changes: 27 additions & 0 deletions scripts/applyComponent.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#===============================================================================
# applyComponent.cmd (ecmccfg, warpper to ecmccomp/applyComponent.cmd)
#- Arguments: n/a
#-d /**
#-d \brief Warpper for ecmccomp/applyComponent.cmd.
#-d \details Checks if ecmccomp is loaded, if not loads, then calls ecmccomp/applyComponent.cmd.
#-d Using this wrapper will ensure that ecmccomp is loaded and therefore minimizes the risks of missing hw config.
#-d NOTE: Only for use if the ecmccomp modeule is accessible (at PSI)
#-d \author Anders Sandström
#-d \file
#-d \param COMP Component name
#-d \param EC_COMP_TYPE (optional) Hardware descriptor, i.e. EL7037, defaults to ECMC_EC_COMP_TYPE or ECMC_EC_HWTYPE set in ecmccfg/addSlave.cmd
#-d \param COMP_S_ID (optional) Slave bus position, defaults to ECMC_EC_SLAVE_NUM set in ecmccfg/addSlave.cmd
#-d \param CH_ID (optional) Channel of slave default to 1
#-d \param MACROS (optional) Special macros, depending on component/slave type:
#-d */

#- Check if ecmccomp is loaded otherwise require it
ecmcEpicsEnvSetCalcTernary(EXE,"'${ecmccomp_DIR=NAN}'=='NAN'","", "#-")
${EXE}require ecmccomp ${ECMCCOMP_VER=''}
#- Check again, now it should be there
${EXE}ecmcEpicsEnvSetCalcTernary(EXE,"'${ecmccomp_DIR=NAN}'=='NAN'","", "#-")
${EXE}ecmcExit Error: ecmccomp module not loaded and not found
epicsEnvUnset(EXE)

ecmcFileExist(${ecmccomp_DIR}applyComponent.cmd,1,1)
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=${COMP}, EC_COMP_TYPE=${EC_COMP_TYPE=${ECMC_EC_COMP_TYPE=${ECMC_EC_HWTYPE=NAN}}}, COMP_S_ID=${COMP_S_ID=${ECMC_EC_SLAVE_NUM=0}}, CH_ID=${CH_ID=1}, MACROS='${MACROS=}'"
4 changes: 2 additions & 2 deletions startup.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#- SYS
#-
#- [optional]
#- ECMC_VER = 9.6.3
#- ECMC_VER = 9.6.6
#- EthercatMC_VER = 3.0.2 (obsolete)
#- INIT = initAll
#- MASTER_ID = 0 <-- put negatuve number to disable master, aka non ec-mode
Expand Down Expand Up @@ -54,7 +54,7 @@ on error halt
#-
#-------------------------------------------------------------------------------
#- load required modules
epicsEnvSet(ECMC_VER,${ECMC_VER=9.6.3})
epicsEnvSet(ECMC_VER,${ECMC_VER=9.6.6})
require ecmc "${ECMC_VER}"

#- Require EthercatMC if used.
Expand Down

0 comments on commit 7b08834

Please sign in to comment.