Supported platforms: CODESYS 3.5 SAFETY

 

How to send and receive variable over SRDO

This section describes how SRDO variables are used with MultiTool Creator code template.

 

CANopen protocols are all executed in non-safety code. CANopen non-safety OD variables are used to transmit SRDO variables to/from CAN.

SafeCANopenSRDO library is used for:

 

A safety project's application has a safety task and non-safety task. Due to lower priority, the non-safety task may be interrupted at any time by the safety task.

If an interruption occurs while the application is handling diverse non-safety SRDO data, the validation will fail. To prevent this, interlock functionality is used.

 

The non-safety CANopenSRDO protocol handler keeps the global lock status TRUE while handling SRDO message's OD data.

The global lock status is used:

 

 

MultiTool code template shall stop SRDO protocol update if

G_StatusFlags_Safe.S_SafeOperationEnable = FALSE

 

If any error is active, the SRDO messages will stop and the receiving side will go into timeout.

See also Reviewing SRDO.

 

The safety control unit's SRDO signatures are automatically calculated by MultiTool Creator.

The signature is validated in the safety control unit's initialization by the code template.

Signature validation affects the S_SafeOperationEnable status. See also, CalculateSRDOSignature (FUN)

 

The SRDO message's refresh time (cyclic tx interval) shall be greater than 2x safety task's cycle time for SRDO to work properly with interlock functionality.

 

CANopen library version 4.0.7.2 or later supports SRDO rx buffering. If multiple SRDO pairs are received on same program cycle, the latest complete pair is copied to OD variables. Multiple pairs may be received, for example, in use case when transmitting device supports event based SRDO sending. E.g. cyclic and event based SRDO is sent within program cycle.

 

SRDO message configuration is done only during CANopen initialization.

The message timeout values are configured with MultiTool Creator.

 

Sending SRDO message pairs

The following architecture is used for SRDO message transmitting. the example image is for a single SRDO variable.

 

 

All of the POUs are automatically generated by MultiTool Creator to code template.

The following example shows how an application updates the transmit SRDO variable using the code template.

 

Safe PRG:

 

 

 

Receiving SRDO message pairs

The following architecture is used for SRDO message receiving. The example image is for a single SRDO variable.

 

 

All of the POUs are automatically generated by MultiTool Creator to code template.

The following example shows how application reads a received SRDO variable using the code template.

 

The application shall check that the received SRDO data is valid before using safety variables for control.

Validity is indicated with, for example, S_Validated_SRDOs_CAN1.o_SRDO_Data_Valid.

The status covers all variables mapped to received SRDOs (CAN bus specific).

 

 

The application has to enable SRDO validation before data is read and validated to safety variables.

Validation enable conditions are application specific but it is recommended to check the transmitting unit's NMT state because SRDO messages are only sent in NMT operational state.

 

 

If an SRDO message error is activated (e.g. timeout), rising edge in validation i_Enable is required before SRDO data can be re-enabled.

 

 

The SRDO validation program's outputs also include all individual SRDO variable statuses, for example, S_Validate_SRDOs_CAN1.o_Status_Cabin_Joystick_Y_Control

 

 

Safe PRG:

 

 

 

See also

 

 

 

Source file topic100472.htm

Last updated 13-Jun-2024