SERCOS Communication Error Notification

If your motion controller uses SERCOS, you can take advantage of specialized status information. The MPIStatusMask in the MPIStatus structure makes it possible to read the MPIStatusFlag(s):

 

/* MPIStatus */
typedef enum {
	MPIStatusFlagINVALID,
	MPIStatusFlagCOMM_ERROR,
} MPIStatusFlag;

#define	mpiStatusMaskBIT(flag)    (0x1 << (flag))

typedef enum {
    MPIStatusMaskNONE         = 0x0,
    MPIStatusMaskCOMM_ERROR   = mpiStatusMaskBIT(MPIStatusFlagCOMM_ERROR),  /* 0x00000001 */
    MPIStatusMaskMOTOR        = MPIStatusMaskCOMM_ERROR,                    /* 0x00000001 */
    MPIStatusMaskALL          = mpiStatusMaskBIT(MPIStatusFlagLAST) - 1	    /* 0x00000001 */
} MPIStatusMask;

typedef struct MPIStatus {
    MPIState        state;
    MPIAction       action;
    MPIEventMask    eventMask;

    long     settled;
    long     atTarget;

    MPIStatusMask     statusMask;
} MPIStatus;

Presently, the only MPIStatusFlag supported is MPIStatusFlagCOMM_ERROR. This flag represents the communication status. For XMP-Series SERCOS controllers, this flag represents the status of the SERCOS communication. When the SERCOS communication ring fails, the MPIStatusFlagCOMM_ERROR is set. The flag can only be cleared by re-initializating the SERCOS ring with mpiSercosInit(...).