![]() |
CANopen Slave Protocol Stack
Version 7.08.00
|
The Synchronisation Object is broadcasted periodically by the SYNC producer. This SYNC provides the basic network clock. The time period between the SYNCs is specified by the standard parameter communication cycle period (Object 1006h: Communication Cycle Period), which may be written by a configuration tool to the application devices during the boot-up process. There can be a time jitter in transmission by the SYNC producer corresponding approximately to the latency due to some other message being transmitted just before the SYNC. In order to guarantee timely access to the CAN bus the SYNC is given a very high priority identifier (Object 1005h). Devices which operate synchronously may use the SYNC object to synchronise their own timing with that of the Synchronisation Object producer. The details of this synchronisation are device dependent.
Functions | |
| void | CosSyncEvent (uint8_t ubSyncCounterValueV) |
| void | CosSyncEventRcvPdo (void) |
| void | CosSyncSetProducer (uint16_t uwTimeV) |
| void CosSyncEvent | ( | uint8_t | ubSyncCounterValueV | ) |
| [in] | ubSyncCounterValueV | SYNC counter value (0 if object 1019h is not supported) |
cos_user.c provides an example and has to be adopted to the application.This function is called upon reception of a SYNC message when the device is in NMT operational state (NODE_STATE_OPERATIONAL). It is the primary synchronization point for application data: use it to latch new input values or to prepare output data before the next synchronous PDO transmission. The parameter ubSyncCounterValueV carries the SYNC counter from the SYNC frame (object 1019h); it is 0 if the SYNC counter is not configured.
| void CosSyncEventRcvPdo | ( | void | ) |
cos_user.c provides an example and has to be adopted to the application.This function is called upon reception of a SYNC message when the device is in NMT operational state and has synchronous Receive PDOs configured. It fires after the stack has already distributed the received SYNC-triggered RPDO data to the mapped process variables. Use it to consume the freshly updated input values in the application. Note that RPDOs do not carry a SYNC counter; this callback fires on every SYNC regardless of the counter value.
| void CosSyncSetProducer | ( | uint16_t | uwTimeV | ) |
| [in] | uwTimeV | SYNC producer time in milli-seconds |
This function allows to enable or disable a SYNC producer by the application. Using a value > 0 for uwTimeV enables the SYNC producer, a value of 0 switches the service to SYNC consumer. The value for uwTimeV is given in multiples of 1 milli-second.
The function has impact on the values of objects 1005h and 1006h and will modify the current setting.
Please refer to the description of CosMgrOnStart() for a code example.