CAN Handling Events
The CAN interface on the XMP generates many different
types of asynchronous events such as:
|
- a change in the XMP's bus state
- a change in a node's health
- a change in the state of an input node's analog or digital
inputs
- an emergency message is transmitted by a node
- a boot message is transmitted by a node
- a lost message is detected by the XMP CAN firmware
|
The events above have been appended to the standard
MPI event handling scheme in order to provide the user the ability to
respond to these events. The diagram below shows an overview of how events
are relayed to the user's application.
|
- The CANOpen firmware detects one of the CAN events.
- There is a mask within the XMP firmware that allows only a specified
set of events to reach the host. This mask is interrogated and
modified with the meiCanEventNotifyGet
and meiCanEventNotifySet functions.
- Like all other events in the MPI, the user must install an Event
Manager on the host. You will find the serviceCreate and serviceDelete
functions from apputils convenient for installing an Event Manager.
- For each thread that needs to know about CAN events, the user
will need to create a notify object, specifying a mask for the
required events.
- The user's application can use the mpiNotifyEventWait
function to either poll or wait for a CAN event to be generated.
A valid event returned from mpiNotifyEventWait may also contain
extra fields of information relevant to the event produced. (ex:
the new bus state or node number).
|
|