This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
This FAQ walks the user through setting up an industrial networking EtherCAT system in CODESYS using an AM6xx MainDevice and one-or-more AM64x/AM243x SubDevice(s). Instructions are provided to set up MainDevice, SubDevice(s), and build the project & visualization in CODESYS Development System to control test LEDs on the SubDevice(s) from the MainDevice
Software versions tested in this documentation:
AM62x Processor SDK version: ti-processor-sdk-linux-rt-am62xx-evm-09.00.00.03 & ti-processor-sdk-linux-rt-am62xx-evm-08.06.00.45: https://www.ti.com/tool/PROCESSOR-SDK-AM62X#downloads
AM243x MCU+ SDK version: mcu_plus_sdk_am243x_08_05_00_24 (as of this writing, the AM243x-LP (HSFS) EtherCAT example demo does not work on MCU+ SDK 08_06. AM243x-EVM does not have this issue): https://www.ti.com/tool/download/MCU-PLUS-SDK-AM243X/08.05.00.24
Code Composer Studio version: Match CCS version to the version listed in the MCU+ SDK: https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/latest/exports/docs/api_guide_am243x/CCS_SETUP_PAGE.html#autotoc_md21
CODESYS Development System: CODESYS Development System V3 3.5.19.10:
(US store) https://us.store.codesys.com/codesys.html
(International store) https://store.codesys.com/en/
CODESYS Control for Linux ARM64 SL: CODESYS Control for Linux ARM64 SL 4.9.0.0.package & CODESYS Control for Linux ARM64 SL 4.2.0.0.package:
(US store) https://us.store.codesys.com/codesys-control-for-linux-arm-sl-bundle.html
(International store)
Old Link: https://store.codesys.com/en/codesys-control-for-linux-arm-sl-bundle.html
Updated Link: https://us.store.codesys.com/codesys-control-for-linux-arm-sl-1.html
System set up instructions overview (clickable links):
System set up instructions overview (clickable links):
Steps to get AM6xx working as the EtherCAT MainDevice:
System set up instructions overview (clickable links):
Steps to get AM64x/AM243x-EVM (GP), AM243x-LP (HSFS), AM243x-EVM (HSFS) working as EtherCAT SubDevice(s):
System set up instructions overview (clickable links):
Steps to get EtherCAT system running:
1. Prior to proceeding with next steps:
2. Confirm you can ping from AM62x-EVM Ethernet port to Ethernet port on Windows PC running CODESYS Development System desktop software
3. Have CODESYS config running on AM62x
4.
5. Open CODESYS Development System project you created earlier
6. Login to AM62x-EVM by clicking gear icon
7.
8. If you receive a pop up that says, “The connected PLC uses certificates which are about to expire. Would you like to open the security screen for details?”
9. Click “No”
10.
a. Can check box that says, “Remember decision” for this example
11. Right-click “EtherCAT_Master (EtherCAT Master)” and select “Scan for Devices…”
12.
13. Wait for scan to complete (“Scan Devices” button on the bottom left of the pop-up window will greyed out while scan is running)
14. When device(s) show up in the list, click “Copy All Devices to Project”
15.
a. If SubDevice(s) do not show up in the list, power cycle SubDevice(s) and try again.
i. If you did not flash the application directly onto the board, you will need to re-load the application onto the R5F_0_0 core manually
b. If SubDevice(s) still do not show up in the list, confirm CODESYS cfg is running on AM62x AND you can ping Ethernet port IP address of Windows PC running CODESYS Development System desktop software
c. If SubDevice(s) still do not show up in the list, re-do steps for setting up EtherCAT SubDevices
16. SubDevices now added under “EtherCAT_Master (EtherCAT Master)”
17.
18. Double-click first SubDevice (if there are more than one)
19. TI_EtherCAT_Toolkit_for_AM243x_R5F tab will open
20.
21. Check box to the left of “Expert settings”
22.
23. CTRL + S to save
24. Repeat for additional SubDevices (if any)
25. Click “Logout” gear icon
26.
27. Click “Login” gear icon
28.
29. If you receive pop window that says, “Warning: The application ‘Application’ is currently in RUN mode on the PLC. However, do you want to download the latest code changes?” Click “Yes”
30.
31. Click “Play” icon
32.
33. On TI_EtherCAT_Toolkit_for_AM243x_R5F tab, select “Expert Process Data” side tab
34.
35. On the bottom right of screen, click “Load PDO Info from the Device”
36. Wait for process to complete
37.
38. Repeat for additional SubDevices (if any)
39. CTRL + S to save
40. Click the “Stop” button
41. Click the “Logout” gear icon
42. Double-click TI_EtherCAT_Toolkit_for_AM243x_R5F
43. In the “TI_EtherCAT_Toolkit_for_AM243x_R5F” tab, click “EtherCAT I/O Mapping”
44. You should see the following:
45.
a. Each SubDevice will have different LED addresses
46. Note the “Address” for Bit0 – Bit7, i.e., %QX0.0 - %QX0.7
a. These are the physical addresses for the test LEDs on the AM243x SubDevice
b. Additional SubDevices will be numbered %QXa.0 - %QXa.7
i. a = n * 8; n = 0, 1, 2, 3, etc. depending on the number of SubDevices you have in your system (with ‘0’ being the first SubDevice)
1. For example, if you have two SubDevices:
a. First SubDevice PLC_PRG code will be:
i. led1_1 AT %QX0.0 : BOOL :=0;
ii. led1_2 AT %QX0.1 : BOOL :=0;
iii. led1_3 AT %QX0.2 : BOOL :=0;
iv. led1_4 AT %QX0.3 : BOOL :=0;
v. led1_5 AT %QX0.4 : BOOL :=0;
vi. led1_6 AT %QX0.5 : BOOL :=0;
vii. led1_7 AT %QX0.6 : BOOL :=0;
viii. led1_8 AT %QX0.7 : BOOL :=0;
b. Second SubDevice PLC_PRG code will be:
i. led2_1 AT %QX8.0 : BOOL :=0;
ii. led2_2 AT %QX8.1 : BOOL :=0;
iii. led2_3 AT %QX8.2 : BOOL :=0;
iv. led2_4 AT %QX8.3 : BOOL :=0;
v. led2_5 AT %QX8.4 : BOOL :=0;
vi. led2_6 AT %QX8.5 : BOOL :=0;
vii. led2_7 AT %QX8.6 : BOOL :=0;
viii. led2_8 AT %QX8.7 : BOOL :=0;
c. etc. for any additional devices
47. Double-click “PLC_PRG” on the sidebar
48.
49. Enter the following code after “VAR”:
led1_1 AT %QX0.0 : BOOL :=0;
led1_2 AT %QX0.1 : BOOL :=0;
led1_3 AT %QX0.2 : BOOL :=0;
led1_4 AT %QX0.3 : BOOL :=0;
led1_5 AT %QX0.4 : BOOL :=0;
led1_6 AT %QX0.5 : BOOL :=0;
led1_7 AT %QX0.6 : BOOL :=0;
led1_8 AT %QX0.7 : BOOL :=0;
50. PLC_PRG should look like this now:
51.
52. My system has four SubDevices so the top-half of my PLC_PRG code looks like this:
53.
54. Next set the initial states of the test LEDs in the lower-half of PLC_PRG
55.
a. Repeat for each additional SubDevice
i. This system has four SubDevices
1.
56. CTRL + S to save
57. Close the “PLC_PRG” tab by clicking the ‘X’ button
58. Return to the “TI_EtherCAT_Toolkit_for_AM243x_R5F” tab
59. Click the “+” to the left of 16#1600 RxPDO, click the “+” to the left Channel “i2c-leds”
60. Double-click the “Variable” input box to the left of “Bit0”
61. A box with “…” will show, click it
62.
63. “Input Assistant” window will open
64.
65. Click the “+” to the left of “Application”, click the “+” to the left of “PLC_PRG”
66.
67. Double-click “led1_1” because variable is assigned to %QX0.0, which is the physical address of Bit0
68. Click “OK” to assign variable “led1_1” to Bit0
69. Double-click the “Variable” input box to the left of “Bit1”
70. A box with “…” will show, click it
71.
72. Variable “led1_2” is assigned to Address %QX0.1, which is the physical address of Bit1
73.
74. Click “OK” to assign variable “led1_2” to Bit1
75. Repeat the process so variable “led1_3” is assigned to Bit2, “led1_4” is assigned to Bit3, … , “led1_8” is assigned to Bit7
76.
77. CTRL + S to save
78. Repeat the process for any additional SubDevices (the LED physical address will be different for additional SubDevices)
79. For the second SubDevice, Bit0 physical address is %QX8.0, Bit1 physical address is %QX8.1, … , Bit7 physical address is %QX8.7
80.
81. Repeat the process from above to assign variables “led2_1” to “led2_8” to %QX8.0 to %QX8.7
82.
83.
84. CTRL + S to save
85. Repeat the process for any additional SubDevices
86. We will now test to see if the test LEDs function as expected based on the initial LED variable values we set in the bottom-half of PLC_PRG
87. Login by clicking the gear icon
88.
a. Make sure CODESYS cfg is running on the AM62x before logging in on the CODESYS Development System desktop software
b.
89. Click “Yes” if you receive a popup message saying, “Warning: The application ‘Application’ is currently in RUN mode on the PLC. However, do you want to download the latest code changes?”
90.
91. “Start” by clicking the “Play” button or press F5
92.
93. Check the LEDs on your AM243x SubDevice, the test LEDs should be on/off based on the initial values we set earlier
94.
95. AM243x-LP test LEDs:
a.
i. AM243x-LP has only (4) physical test LEDs, but there are physical addresses for (8) LEDs
ii. (2) test LEDs are turned on in this image
96. AM243x-EVM & AM64x/AM243x-EVM test LEDs:
a.
i. All (8) test LEDs are turned on in this image
97. Now we will set up the visualization to control the LEDs during a demonstration
98. Press the “Stop” button, then click the “Logout” gear icon
99. On the left-side meu, right-click “Application”, go to “Add Object”, then select “Visualization…”
100.
101. Check the box under “Active” in the “Add Visualization” window that pops up, then click “Add”
102.
103. On the left-side menu, double-click “Visualization”
104.
a. If you do not see any icons in the “Visualization Toolbox” tab, press the up arrow in the the window
b.
105. We will do two things:
a. First, we will add a “Lamp” and assign it to an LED variable to show the current state of that LED
i. In the “Visualization Toolbox”, click the button that says, “Lamps/Switches/Bitmaps”
1. Icons will show in the lower half of the “Visualization Toolbox”
2. Drag the “Lamp” into the Visualization tab
3.
4. In the “Properties” window, double-click the blank space to the right of “Variable” and click “…”
5.
6. “Input Assistant” window will pop up. Select the first LED variable (led1_1 in this example) and click OK
7.
8. The “Lamp” icon will now show the state of the first LED variable
9. Repeat the process for the other eight LEDs, i.e., the second “Lamp” icon will be assigned to led1_2, the third led1_3, etc. until all variables are assigned to icons
10.
11. Repeat the process if there are additional SubDevices. The image below has eight LEDs in each horizontal row, and four total rows to represent four devices.
12.
a. If you want to change the icon theme, on the left-side menu, double-click “Visualization Manager”, in the tab that opens, click the drop-down for “Selected style” and choose a different style. This example uses “Flat style”
b.
13. CTRL + S to save
14. Test that the Lamps reflect the correct state of the LEDs that was set in PLC_PRG by doing logging in by clicking the “Gear” icon and pressing the “Play” button
15.
a. If you receive a popup window that says, “The application changed since last download. What do you want to do?”, select “Login with online change” and click “OK”
b.
c. Switch to the “Visualization” tab (and hit the “Play” button if the program is not already running)
d. The visualization will match the variable LED states set if set correctly
e.
f. Click the “Gear” icon to logout and continue with instructions for setting up button to toggle the LED states
b. Second, we will add a “Rectangle” box, and assign it to toggle an LED variable that will turn that LED on/off
i. In the top-half of the “Visualization Toolbox” select the “Basic” button
ii.
iii. Drag a “Rectangle” icon to the “Visualization” tab and resize the icon so you will be able to place a “Rectangle” under each “Lamp”
iv. Click the center of the “Rectangle” icon you added and set its name
v.
vi. Select the “Rectangle” box and in the “Properties” window, scroll down and click the “+” to the left of “Input Configuration”, then click the “+” to the left of “Toggle”, in the “Variable” section, double-click the empty box until “…” icon shows up, click the “…” icon
vii.
viii. In the “Input Assistant” pop up window, select “led1_1” and click “OK”
ix. CTRL + S to save
x. Repeat the process for all LEDs, i.e., assign the second “Rectangle” to variable “led1_2”, etc.
xi.
xii. The image below is for a set up with four SubDevices
xiii.
xiv. CTRL + S to save
xv. Now we will test the buttons
xvi. First it is recommended to power cycle the AM243x SubDevice(s). You do not need to power cycle the AM62x-EVM Main Device. If you power cycle the AM62x-EVM, you will need to set the ethernet port IP address again on the AM62x-EVM
xvii. Restart the CODESYS cfg on the AM62x terminal (if it is already running press CTRL + C to cancel the process, then run the command to restart CODESYS cfg
1. /opt/codesys/bin/codesyscontrol.bin /etc/CODESYSControl.cfg
2.
xviii. Right-click “Device (CODESYS Control for Linux ARM64 SL)”, select “Reset Origin Device [Device]”
xix.
xx. Click “Yes” in the CODESYS popup
xxi.
xxii. In the “Device” tab, click “Scan Network”
xxiii.
xxiv. In the “Select Device” window, double-click “am62xx-evm”
xxv.
xxvi. Enter username and password, click “OK” then enter the username and password in the new popup window that opens
xxvii.
xxviii. Click the “Gear” icon to login to the device
xxix.
xxx. If you receive the “CODESYS” pop up window that says, “The application ‘Application’ does not exist on device ‘Device’. Do you want to create it and proceed with download?”, click “Yes”
xxxi.
xxxii. Press the “Play” and the buttons should be highlighted when the LED is on, you will not be able to control the states of the LEDs at this point. There is one more step that must be done before we can control the LEDs live
xxxiii.
xxxiv. Logout of the device by clicking the “Gear” icon
xxxv. Go to the PLC_PRG tab (or double-click PLC_PRG on the left-side menu if the tab is not already open)
xxxvi. CTRL + A to highlight all the initial LED states we set, right-click anywhere within the PLC_PRG window, select “Advanced”, then “Comment out selected lines”
xxxvii.
xxxviii. CTRL + S to save
xxxix.
xl. Login to the device by clicking on the “Gear” icon, click “OK” on the CODESYS popup to “Login with online change”
xli.
xlii. Go to the “Visualization” tab and push some buttons and see the test LEDs change on the AM243x SubDevice(s)
xliii.
xliv. When you are done, go to the PLC_PRG tab, press CTRL + A, then right-click, move the cursor “Advanced”, then select “Uncomment selected lines”
xlv.
xlvi. CTRL + S to save
Congratulations, you have set up an EtherCAT system with an AM62x & one-or-more AM243x SubDevice!