background image

XMC4800 EtherCAT

®

generic slave example

Getting started V1.0

July 2016

Содержание XMC4800

Страница 1: ...XMC4800 EtherCAT generic slave example Getting started V1 0 July 2016 ...

Страница 2: ...Agenda Overview and requirements Setup Description How to test 1 2 3 4 2 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 3: ...Agenda Overview and requirements Setup Description How to test 1 2 3 4 3 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 4: ...g this example you will see in output direction the EtherCAT master controlling the 8 LEDs on the XMC EtherCAT PHY Board and dimming LED2 of the Relax Kit In input direction you will monitor inside the master device the status of the buttons available on the Relax Kit You will observe inside code how you can modify the mapping of the generic data structures to the I Os for your own evaluations and...

Страница 5: ...Relax EtherCAT Kit RJ45 Ethernet Cable Windows Laptop installed DAVE v4 Version4 1 4 or higher TwinCAT2 or TwinCAT3 Master PLC Micro USB Cable Debugger connector 5 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 6: ...ial used inside this document as reference Link Download TwinCAT2 or TwinCAT3 no trial period usability limited Link Download TwinCAT3 DAVE v4 1 4 or higher Link Download DAVE Version 4 6 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 7: ...Agenda Overview and requirements Setup Description How to test 1 2 3 4 7 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 8: ...Setup Hardware Ethernet cable connected to in port Micro usb cable debugger connected to X101 debug connector 8 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 9: ...Setup Import example project into DAVE build 1 2 3 4 9 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 10: ..._EtherCat_Slave xml 2 Copy the device description file to your TwinCAT installation C TwinCAT Io EtherCAT 3 If TwinCAT System Manager is currently running already exit TwinCAT 4 Start TwinCAT You should see device description cache being re worked automatically because the new device is added 10 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 11: ...Agenda Overview and requirements Setup Description How to test 1 2 3 4 11 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 12: ...stration purpose within this example only and is not certified not conform and not planned to be used in any other context than this example here Established tool providers may help you in your product development and certification A list of vendors can be found here https www ethercat org en prod ucts html 12 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 13: ...e the slave device 2 ECAT_registerCb To register a callback Inside the callback the I O data from to master is processed and e g connected to hardware ports timers PWM 3 ECAT_main_loop Main loop called inside while 1 to process the state machine 13 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 14: ...ave library The size of generic data in both directions is 4x16 bit and 8x1 bit Check the types IN_object OUT_object inside the headerfile ECAT_GenericNode h for details 14 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 15: ...he EtherCAT ports is provided For the example provided the configuration is fixed to the LQFP144 which fits to the XMC4800 Relax EtherCAT Kit Inside main during initialization the port configuration is set in place by calling ECAT0_Init 15 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 16: ...x EtherCAT Kit PWM_CCU8 is used The PWM is set to start during initialization frequency is 500 Hz and the initial duty cycle is set to 50 The pin P5 8 is allocated to channel1 of CCU8 inside manual pin allocator right click PWM_CCU8 APP 16 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 17: ...InitECAT_Adapt_LED and Init_Relax Button are used to initialize the buttons and LED1 to 8 of the XMC EtherCAT PHY Board Finally the generic EtherCAT slave node is initialized the callback is registered and the ECAT_main_loop is called cyclic to process the state machine 17 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 18: ...ster slave is used to set the level of LED1 to 8 of XMC EtherCAT PHY Board The integer output data is used to set the duty cycle of the dimmable LED2 Finally the states of the buttons are checked and propagated to the input data slave master 18 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 19: ...Agenda Overview and requirements Setup Description How to test 1 2 3 4 19 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 20: ...nd start debugger 2 Start the software to run OBSERVATIONS 1 The ERR LED on the XMC EtherCAT PHY Board will turn on and immediately turn off again 2 The LED2 on the XMC4800 Relax EtherCAT Kit will remain turned on 20 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 21: ... 4 ACTIONS After starting the TwinCAT System Manager from windows start menu 1 Right Click I O Devices and select Append Device 2 Create an EtherCAT master device by double click 1 2 1 2 21 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 22: ...and select Application hint In case the device is not found please install the respective device driver by following the instructions given by TwinCAT through the Compatible Devices button 4 Right Click EtherCAT master and select Scan Boxes 3 4 3 4 22 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 23: ...e TwinCAT 2 master to run 3 4 OBSERVATIONS The slave appears as a node on the bus of the EtherCAT master The RUN LED is flashing indicating PREOP state 1 2 1 2 23 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 24: ... Inside the EtherCAT master online state you see the queued frames counting up the connected slave and its PREOP state EtherCAT slave view The PREOP state of the slave is indicated within the TwinCAT system manager 3 4 3 4 24 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 25: ...ew Online status of slave shows the slave in OP state EtherCAT master view Online status of master shows the slave in OP state Frames are no more queued Cyclic counter is incrementing XMC EtherCAT PHY Board RUN LED is static turned on indicating OP state 1 2 3 25 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 26: ...While pushing Button1 on XMC4800 Relax EtherCAT Kit button state is updated on host OBSERVATIONS State of IN_GEN_Bit1 changes according state of BUTTON1 Same is true for IN_GEN_Bit2 and BUTTON2 26 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 27: ...ontext menu Change the value from 0 to 1 to switch on LED1 from 1 to 0 to switch off LED1 OBSERVATION LED1 XMC EtherCAT PHY Board is turned on off according to OUT_GEN_Bit1 setting How to test Setting slave outputs on master 1 2 27 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 28: ... select Online Write inside the context menu Change the value from 0 to 50000 OBSERVATION 1 Brightness of LED2 on XMC4800 Relax EtherCAT Kit is dimmed Setting OUT_GEN_INT1 to 65535 the LED2 is turned off The lower the value the brighter the LED2 28 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 29: ...Technical Videos Product Information Videos Forums Product Support Support material Collaterals and Brochures Technical Material Videos Contact www infineon com XMC www infineon com XMC Kits and Boards DAVETM Software and Tool Ecosystem Infineon Media Center XMC Mediathek Infineon Forums Technical Assistance Center TAC 29 Copyright Infineon Technologies AG 2016 All rights reserved ...

Страница 30: ...or warranty of a certain functionality condition or quality of the Infineon Technologies component Infineon Technologies hereby disclaims any and all warranties and liabilities of any kind including without limitation warranties of non infringement of intellectual property rights of any third party with respect to any and all information given in this training material Disclaimer ...

Страница 31: ......

Отзывы: