25.5. OpENer Erpc Motor
25.5.1. 1.Overview
The OpENer Erpc Motor dual core example is used to demonstrate the function of realizing remote motor speed control through the Ethernet/IP (EIP) protocol using OpENer. Core0 runs FreeRTOS, Lwip and OpENer, core1 runs motor controlling mothod, while erpc is used between two cores.
For how to use erpc, see middleware/samples/multicore/erpc/erpc_matrix_multiply_rpmsg_bm/README_en.md
25.5.2. 2.Preparation
25.5.2.1. 2.1 Hardware
A development board with Ethernet. Refer to the {ref}pin description <board_resource> of the specific development board to view the Ethernet hardware.
According to your development board, select RMII/RGMII and ethernet phy in the CMakeLists.txt
A PC with a network port.
The TwinCAT3 software has adaptation issues with PC network cards. Some supported Intel network cards.
This program uses the BLM57050-1000 brushless motor of “Leisai Intelligence”, please refer to the Leisai Intelligence website for the specific parameters of the motor.
Board settings refer to the development board documentation Motor Pin related content
25.5.2.2. 2.2 Software
TwinCAT3.1(Build 4024.56)
25.5.3. 3. TwinCAT project settings
25.5.3.1. 3.1 Create a project
Open the TwinCAT software and select File -> New -> Project.
![]()
Select TwinCAT Project, name it and click OK.
![]()
25.5.3.2. 3.2 Software configuration
Update the network card driver (required when using for the first time).
![]()
![]()
Clock setting
- When the software is running, the following error may be encountered: It is necessary to run C:TwinCAT3.1Systemwin8settick.bat with administrator privileges.
Init4RTime:Start Interrupt:Ticker started >> AdsWarning4115 (0x1013,RTIME:system clock setup failed) - - -
![]()
25.5.3.3. 3.3 Add EIP Scanner
Click on Device, right-click to add a new item.
![]()
Select EIP Scanner.
![]()
Select the network card after the driver is updated.
![]()
Configure the IP address.
![]()
Re-enter the configuration mode to make the IP configuration in the previous step take effect.
![]()
25.5.3.4. 3.4. Add EDS file
Right-click on EIP Scanner and select import EDS file. Select opener/opener_blinky_app.eds.
![]()
25.5.3.5. 3.5. Scan devices
Right-click on EIP Scanner and then scan.
![]()
Add a device.
![]()
25.5.3.6. 3.6 Add IO connection
![]()
If there is no Exclusive Owner is the combox, specify the eds file manually.
![]()
25.5.3.7. 3.7 IO operation
For input IO, press the button KEYA on the evaluation board, and the value of Input/Key State changes.
![]()
For output IO, right-click on Led State, select Online, and click Write to write a value. When writing 1, the LED on the development board lights up. When writing 0, the LED on the development board turns off.
![]()
For output IO. Right-click “Motor Target Speed”, select “Online”, and click “Write” to enter a value. The motor rotates according to the input value. Note that the upper limit of the motor speed is 35.
![]()
For input IO. Observe “Inputs/Motor Current Speed”, which shows the real-time motor speed.
![]()
For input IO, right-click Break, select Online, and write values by motor Write. When inputting 1, the motor stops rotating. When inputting 0, the motor resumes the rotating state before stopping.
![]()
25.5.4. 6. Operation phenomenon
After the project runs correctly, the serial terminal will output the following information. The input and output IO states correspond to the TwinCAT project configuration:
This is an Ethernet/IP demo.
LwIP Version: 2.1.2
Enet phy init passed !
Primary core started
Copying secondary core image to destination memory: 0x80003178
Starting secondary core...
Link Status: Down
Secondary core started...
Link Status: Down
Link Status: Down
Link Status: Down
Link Status: Down
Link Status: Up
Link Speed: 100Mbps
Link Duplex: Full duplex
IPv4 Address: 192.168.100.10
IPv4 Netmask: 255.255.255.0
IPv4 Gateway: 192.168.100.1
eRPC request is sent to the server