Generate SSC code for servo motor
Due to the license issue, the MCUXpresso SDK does not include the EtherCAT Subdevice Stack Code (SSC). The SSC Tool must generate the subdevice stack code first. This section lists the steps to download the SSC tool and generate the subdevice stack code for the servo motor example via the SSC tool.
Note: You must have a Backoff account to download the EtherCAT SSC tool.
Download and install the SSC tool.
Click the link https://www.ethercat.org/en/downloads.html.
Type SSC in the Text Filter field.
Select the EtherCAT Subdevice Stack Code (SSC) link under the Description column.
Note: To proceed with the download, you must provide your account credentials, if you are not already logged in.
Install the downloaded SSC tool.
Launch the SSC tool.
Import the configuration file for the servo motor example.
Select Tool > Options.
The Subdevice Stack Code Tool | Options window appears.
Click the Configurations tab.
To open the Import Configuration file(s) dialog box, click the + icon.
Navigate to the \boards\evkmimxrt1180\ecat_examples\servo_motor\cm7\SSC folder.
Select the servo_motor.xml file.
Click the Open button.
The configuration is imported.
Create a new project with the imported configuration.
Select File > New.
The New Project dialog box appears.
Select the Custom option.
Select NXP ECAT Servo Motor modular <NXP> from the drop-down list.
Save this new project as ECAT-SERVO-MOTOR.esp to any folder.
Select File > Save.
Save the file with an appropriate name. For example, ECAT-SERVO-MOTOR.esp.
Create the subdevice stack code for the servo motor example.
Click Project > Create new Subdevice Files.
The Create new Subdevice Files dialog box appears.
To create the code, select Start.
By default, the code is located in the Src subfolder under the folder where the project is saved.
Copy the Src subfolder to boards\evkmimxrt1180\ecat_examples\ servo_motor\cm7\SSC\Src under the SDK source code.
Apply patch.
Change to .\boards\evkmimxrt1180\ecat_examples\servo_motor\cm7\SSC path. Install patch tool.
To apply the patch on Linux:
Download dos2unix command
apt-get install dos2unix
.Transfer SSC source code format
dos2unix Src/*
.Apply patch by using the command
patch -d Src < CiA402-combine-the-SSC-subdevice-with-ec_pmsm-support.patch
.
To apply the patch on Windows:
Download the
patch.exe
andUnix2Dos.exe
tools.Download Windows patch utility from http://gnuwin32.sourceforge.net/downlinks/patch-bin-zip.php.
Download
Dos2Unix/Unix2Dos-Text
file format converters from https://sourceforge.net/projects/dos2unix/.
Transfer the patch format.
$(Dos2Unix/Unix2Dos-DIR)/bin/unix2dos.exe …\boards\evkmimxrt1180\ecat_examples\servo_motor\cm7\SSC\CiA402-combine-the-SSC-subdevice-with-ec_pmsm-support.patch
.Apply patch by using the command
./patch.exe -i …\boards\evkmimxrt1180\ecat_examples\servo_motor\cm7\SSC\CiA402-combine-the-SSC-subdevice-with-ec_pmsm-support.patch -d …\boards\evkmimxrt1180\ecat_examples\servo_motor\cm7\SSC\Src\
.
Note: Patch and Unix2Dos are command line tools. To check their functions through command like use
patch --help/unix2cos -help
.