Hardware requirements
MIMXRT1180-EVK RevC
RJ45 Network cable
Mini/micro USB cable
Personal Computer on which the TwinCat3 has been installed
Board settings
No special settings are required.
Prepare the Demo
Generate the SSC source code
Download Slave Stack Code Tool(SSC Tool) from BECKHOFF official website and install it
Open Slave Stack Code Tool
Click ‘File’ -> ‘New’ -> ‘Import’ to import the Congfig file Select foe.xml under path ‘.\boards\evkmimxrt1180\ecat_examples\foe<core>\SSC’.
Click ‘Tool’ -> ‘Application’ -> ‘Import’ to import Application information Select foe.xlsx under path ‘.\boards\evkmimxrt1180\ecat_examples\foe<core>\SSC’.
Click ‘Project’ -> ‘Create new Slave Files’ ‘Source Folder’(default): ‘.\boards\evkmimxrt1180\ecat_examples\foe<core>\SSC\Src’. Click ‘Start’.
Remove foe.c under Src folder
Connect EtherCAT Port0 with TwinCAT3 RJ45 interface labeled as J28 is the EtherCAT Port0 and RJ45 interface labeled as J32 is the EtherCAT Port1.
Connect a USB cable between the host PC and the OpenSDA USB port on the target board
Open a serial terminal with the following settings
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download mcuboot_opensource program to the target board
Change EVK SW5[1..4] to 0000 and press the reset SW3 key.
Enter ‘boards\evkmimxrt1180\ota_examples\mcuboot_opensource\cm33’, compile and use ‘SPSDK tool’ download to board.
Download the signed FoE image to the target board
Compile FoE image
Install imgtool by the Python package manager ‘pip install imgtool’
Generate FoE example signed image ‘imgtool sign –key sign-rsa2048-priv.pem –align 4 –header-size 0x400 –pad-header –slot-size 0x200000 –pad –confirm –max-sectors 800 –version “2.3.0” ecat_examples_foe_cm33.bin ecat_foe_2-3-0_SIGNED.bin’
Download the image into target board Open Jlink Command Line: ‘JLink.exe -device MIMXRT1189xxx8_M33 -if SWD -speed 15000’ ‘r’ ‘h’ ‘loadbin ecat_foe_2-3-0_SIGNED.bin 0x28040000’ ‘qc’
Run FoE example
Change EVK SW5[1..4] to 0100 and press the reset SW3 key.
The serial port will output: hello sbl. Bootloader Version 1.9.0 Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1 Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 Boot source: primary slot Swap type: none Bootloader chainload address offset: 0x40000 Reset_Handler address offset: 0x40400 Jumping to the image
Start the SSC FoE example… Image version: 2.3.0
Update ESI file to EEPROM
Copy ESI file ‘ECAT-FOE.xml’ generated by SSC TOOL to <TwinCAT_installation_folder>/
/Config/io/EtherCAT/ Restart TwinCAT3 IDE
Scan device and Update EEPROM
Scan and load this device and create a PLC project in TwinCat3 The PLC Main code is as follows: PROGRAM MAIN VAR Delay : TON; LedIn AT %I* : BOOL; LedOut AT %Q* : BOOL; END_VAR
Delay(IN := TRUE, PT := T#1S); IF Delay.Q THEN LedOut := NOT LedIn; Delay(IN := FALSE); END_IF;
Activate configuration
Click ‘TwinCAT’ -> ‘Restart TwinCAT(Config Mode)’ to activate configuration
FoE image upgrade
Generate new version FoE example signed image ‘imgtool sign –key sign-rsa2048-priv.pem –align 4 –header-size 0x400 –pad-header –slot-size 0x200000 –max-sectors 800 –version “2.4.0” ecat_examples_foe_cm33.bin ecat_foe_2-4-0_SIGNED.bin’
Click ‘Device’ -> ‘Box1’ -> ‘Online’ -> ‘Bootstrap’
Click ‘Download’ -> ‘ecat_foe_2-4-0_SIGNED.bin’ -> ‘Password’ -> ‘Ok’ to upgrade image
The serial port will output: storage addr: 0x28240000 FoE_StoreImage: processed 256 bytes FoE_StoreImage: processed 512 bytes … FoE_StoreImage: upload complete (42028 bytes) write magic number offset = 0x43ff00 Update image success
After download, click ‘Init’ to restart board
FoE image download
Click ‘Upload’ -> ‘ecat_foe_2-4-0_SIGNED.bin’ -> ‘Ok’ to download upgraded image
Note: - FoE download Password: 12369874 - For subsequent upgrades, new version number must be greater than the old version number, perform step 11 to generate the new version signed image - For more mcuboot information, please refer to mcuboot_opensource example