![]() |
ECAT_Slave_in_ПЧ2П_c402
0.8
Реализация EtherCAT Slave для CM TMS320F28388D
|
Implementation This file contains the Process Data interface. Подробнее...
#include "ecatslv.h"#include "ecatappl.h"#include "coeappl.h"#include "applInterface.h"#include "cia402appl.h"Макросы | |
| #define | _ECATAPPL_ 1 |
| #define | _APPL_INTERFACE_ 1 |
| #define | MEASUREMENT_ACTIVE (((sSyncManOutPar.u16GetCycleTime & 0x1) == 0x1) || ((sSyncManInPar.u16GetCycleTime & 0x1) == 0x1)) |
Функции | |
| UINT32 | GetSystemTimeDelay (UINT32 u32StartTime) |
| indicates if the initialization is finished Подробнее... | |
| void | HandleCycleTimeMeasurement (void) |
| In case of non DC synchronization the cycle time measurement is started and 0x1C3.2 (Cycle time) is updated. Подробнее... | |
| void | PDO_InputMapping (void) |
| This function will copies the inputs from the local memory to the ESC memory. Подробнее... | |
| void | PDO_OutputMapping (void) |
| This function will copies the outputs from the ESC memory to the local memory. This function is only called in case of an SM2 (output process data) event. Подробнее... | |
| void | ECAT_CheckTimer (void) |
| This function shall be called every 1ms. Подробнее... | |
| void | PDI_Isr (void) |
| void | Sync0_Isr (void) |
| void | Sync1_Isr (void) |
| void | ECAT_SetLedIndication (void) |
| This function shall called within a 1ms cycle. Set Run and Error Led depending on the Led state. Подробнее... | |
| PROTO UINT16 | MainInit (void) |
| Initialize the generic slave stack. Подробнее... | |
| PROTO void | MainLoop (void) |
| This function handles the low priority function like EtherCAT state machine. Подробнее... | |
| void | ECAT_Application (void) |
| ECAT_Application (prev. SSC versions "COE_Application") this function calculates and the physical process signals and triggers the input mapping. Подробнее... | |
Переменные | |
| UINT32 | u32CycleTimeStartValue |
| UINT32 | u32MinCycleTimeStartValue |
| contains the timer start value to measure the application cycle (used in freerun and SM2 sync) Подробнее... | |
| UINT32 | u32SystemTimeReadFailure |
| timeout counter in ms to measure the process timings (stored in 0x1C3x) Подробнее... | |
| BOOL | bMinCycleTimeMeasurementStarted |
| System time measurement failure (the value is calculated on main init) Подробнее... | |
| UINT32 | u32MinCycleTimeValue |
| Indicates if the min cycle measurement is started. Подробнее... | |
| UINT16 | aPdOutputData [(MAX_PD_OUTPUT_SIZE >>1)] |
| tmp value of the min cycle time during measurement Подробнее... | |
| UINT16 | aPdInputData [(MAX_PD_INPUT_SIZE >>1)] |
| VARVOLATILE UINT8 | u8dummy |
| BOOL | bInitFinished = FALSE |
Implementation This file contains the Process Data interface.
Changes to version V5.12:
V5.13 CIA402 3: change define "CIA402_DEVICE" to "CiA402_SAMPLE_APPLICATION"
V5.13 CIA402 4: decouple CIA402 state machine and application from ESM (according ETG.6010, clause 4)
V5.13 COE4: update default entry name handling in case of 16Bit characters, add CoE Read/write indication functions
V5.13 ECAT 5: check inputsize before calling PDO_InputMappingdo not call PDO_InputMapping in case of no available process data
V5.13 ECAT 6: change input mapping trigger in case of DC Sync
V5.13 ECAT1: handle Sync mapped to AL Event
V5.13 ECAT4: set delay between EEPROM access retries to 10ms
V5.13 EEPROM1: update eeprom reload in case of ESC 32Bit access (and the small eeprom emulation)
V5.13 TEST6: add 0xA002 monitoring ob function calls
Changes to version V5.11:
V5.12 APPL1: add optional application function called from the main loop (after mbx and esm are executed)
V5.12 BOOT1: add a bootloader sample application (only the ESM and FoE is supported)
V5.12 COE4: add timestamp object (0x10F8) and update diagnosis handling
V5.12 ECAT1: update SM Parameter measurement (based on the system time), enhancement for input only devices and no mailbox support, use only 16Bit pointer in process data length caluclation
V5.12 ECAT3: update PD monitoring variables even if the slave is not in OP, disable all interrupts in case that the pd handling is called from the mainloop
V5.12 ECAT5: update Sync error counter/flag handling,check enum memory alignment depending on the processor,in case of a polled timer disable ESC interrupts during DC_CheckWatchdog
V5.12 ECAT8: reset appl function pointer on startup, update timeout calculation during eeprom access
V5.12 EEPROM1: get read size from register 0x502.6
V5.12 EEPROM2: clear CRC Error bit only in case of a valid reload, write station alias only in case of an successful reload,handle full eeprom emlation relaod commands
V5.12 EEPROM3: implement a store EEPROM timeout handler
Changes to version V5.10.1:
V5.11 COE3: change 0x10F3.2 (Sync Error limit) from UINT32 to UINT16 (according to the ETG.1020)
V5.11 ECAT1: update EEPROM access reset operation
V5.11 ECAT10: change PROTO handling to prevent compiler errors
V5.11 ECAT11: create application interface function pointer, add eeprom emulation interface functions
V5.11 ECAT2: update EEPROM access retry cycle (add 10ms delay between two retry cycles)
V5.11 ECAT3: handle bus cycle calculation for input/output only devices and create warning diag message only if calculation failed
V5.11 ECAT4: enhance SM/Sync monitoring for input/output only slaves
V5.11 ECAT6: add function to calculate bus cycle time
V5.11 ECAT8: call PDO_InputMapping only once if DC is enabled and COE is not supported
V5.11 EEPROM1: fix compiler error during pEEPROM pointer initialization
V5.11 EEPROM2: write Station alias value to EEPROM data register on EEPROM reload command
V5.11 EEPROM3: clear EEPROM error bits
V5.11 EEPROM4: prevent the variable in the EEPROM busy loop to be removed by the compiler
V5.11 ESM7: "add Sync define for 0x22 (""SYNCTYPE_SM2_SYNCHRON""), support value 0x22 for 0x1C33.1 (SM2 sync)"
Changes to version V5.01:
V5.10 COE1: Define one entry description for all 0x1C3x objects and change data type of SI11,12,13 to UINT16 (according ETG.1020)
V5.10 ECAT1: Correct calculation of blinking and flashing sequence
V5.10 ECAT13: Update Synchronisation handling (FreeRun,SM Sync, Sync0, Sync1)
Compare DC UINT configuration (by ESC Config data) vs. DC activation register settings
Update 0x1C3x entries
V5.10 ECAT2: Prevent EEPROM data null pointer access (if the pointer is null an command error is set)
EEPROM emulation return command error if unknown command was received
V5.10 ECAT4: Update alignment macro for 8 to 15 bit alignments (16 and 32 Bit controllers)
Bugfix calculate LED blink frequency
V5.10 ECAT7: Add "bInitFinished" to indicate if the initialization is complete
V5.10 HW2: Change HW_GetTimer return value to UINT32
Changes to version V5.0:
V5.01 APPL3: Include library demo application
V5.01 ESC1: Change ESC access function (if EEPROM Emulation is active)
V5.01 ESC2: Add missed value swapping
Changes to version V4.40:
V5.0 TEST1: Add test application. See Application Note ET9300 for more details.
V5.0 ECAT2: Application specific functions are moved to application files.
V5.0 ECAT3: Global dummy variables used for dummy ESC operations.
V5.0 ESC1: ESC 32Bit Access added.
V5.0 ESC3: Add EEPROM emulation support.
V5.0 ESM3: Handling pending ESM transitions.
V5.0 ESC5: Enhance EEPROM access handling.
V5.0 PDO1: AL Event flags are not rechecked in PDO_OutputMappping(). (Already checked before call function)
V5.0 SYNC1: Add missed SM event indication (0x1C32/0x1C33 SI11).
Changes to version V4.30:
V4.40 DIAG1: add diagnosis message support
V4.40 PDO1: merge content of HW_InputMapping (spihw.c/mcihw.c) to PDO_InputMapping. merge content of HW_OutputMapping (spihw.c/mcihw.c) to PDO_OutputMapping.
V4.40 PDO2: Generic process data length calculation
V4.40 ECAT2: call cyclic CheckIfLocalError() to check the local flags
V4.40 HW0: Generic hardware access functions. Add Function (PDI_Isr()), content merged from spihw.c and mcihw.c.
V4.40 WD1: define (ESC_SM_WD_SUPPORTED) to choose ESC SyncManager watchdog or local watchdog
V4.40 ESM2: Change state transition behaviour from SafeOP to OP
V4.40 TIMER1: Change bus cycle time calculation and trigger of ECAT_CheckTimer() if ECAT_TIMER_INT is reset
V4.40 HW1: Add support for fc1100 hardware
Changes to version V4.20:
V4.30 EL9800: EL9800_x cyclic application is moved to el9800.c
V4.30 OBJ 3: add object dictionary initialization
V4.30 SYNC: add CalcSMCycleTime() (calculation of bus cycle time); change synchronisation control functions
V4.30 PDO: include PDO specific functions (moved from coeappl.c).
xxx_InputMapping(); xxx_OutputMapping(); xxx_ReadInputs(); xxx_ResetOutputs(); xxx_Application()
V4.30 CiA402: Add CiA402_StateMachine() and CiA402_Application() call
V4.20 DC 1: Add DC pending Statemachine handling
V4.20 PIC24: Add EL9800_4 (PIC24) required source code
V4.20 LED 1: Modified LED Handling
V4.11 APPL 1: The checkWatchdog() function should not called in checkTimer() if this function is triggered by an Interrupt
Changes to version V4.08:
V4.10 LED 1: The handling of the EtherCAT-Error-LED was added
V4.10 AOE 3: The AoE fragment size has to be initialized during the state transition
from INIT to PREOP
Changes to version V4.07:
V4.08 LED 1: The handling of the EtherCAT-LED can be (de-)selected by the switch LEDS_SUPPORTED
because the ET1100 and ET1200 have an output port which could be connected directly.
Changes to version V4.01:
V4.02 ECAT 1: The watchdog timer variables shall be initialized.
Changes to version V4.00:
V4.01 APPL 1: If the application is running in synchron mode and no SM event
is received, the application should be called from the main loop
V4.01 APPL 2: In FreeRun mode the output should only be copied if the slave is in OP
Changes to version V3.20:
V4.00 APPL 1: The watchdog checking should be done by a microcontroller
timer because the watchdog trigger of the ESC will be reset too
if only a part of the sync manager data is written
V4.00 APPL 2: The setting of EtherCAT state LEDs were included
V4.00 APPL 3: The outputs should be reset to a safe state,
when the state OP is left
V4.00 APPL 4: An example for the EEPROM access through the ESC is shown in
the function APPL_StartMailboxHandler
V4.00 APPL 5: The inputs should be read once when the state transition
from PREOP to SAFEOP is made
V4.00 APPL 6: The main function was split in MainInit and MainLoop
См. определение в файле ecatappl.c