Documentation PDF

MUXDLL  V6.55

Modules

 CAN Configuration
 

Functions

_MUXSPEC tMuxStatus _MUXAPI CanActivate (unsigned short wCard, unsigned short wBus)
 Starting communication. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanBusOn (unsigned short wCard, unsigned short wBus)
 Controller reconnection after bus off. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanChangeBaudRate (unsigned short wCard, unsigned short wBus, tCanBus *hCanBus)
 Change the speed of the bus. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanClearFifoRx (unsigned short wCard, unsigned short wBus)
 Clears the reception FIFO. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanCreateMsg (unsigned short wCard, unsigned short wBus, tCanMsg *hCanMsgNew)
 Configuration of communication messages. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanDeactivate (unsigned short wCard, unsigned short wBus)
 Stopping communication. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanGetBusState (unsigned short wCard, unsigned short wBus, tCanChipState *eCanChipState, unsigned char *bTxErrCount, unsigned char *bRxErrCount)
 Reading CAN controller status. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanGetEvent (unsigned short wCard, unsigned short wBus, tCanEvent *hCanEvent)
 Reading of an event. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanGetFifoRxLevel (unsigned short wCard, unsigned short wBus, unsigned short wParam, unsigned short *wCount, unsigned short *wMaxCount)
 Clears the reception FIFO. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanGetStat (unsigned short wCard, unsigned short wBus, tCanStat *hCanStat)
 Reading statistics counters. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanIsBusActive (unsigned short wCard, unsigned short wBus, unsigned short *wState)
 Gives CAN controller status. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanReadByte (unsigned short wCard, unsigned short wBus, unsigned short wOffset, unsigned char *bData)
 Direct reading of CAN protocol controller. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanSendMsg (unsigned short wCard, unsigned short wBus, tCanMsg *hCanMsg)
 Sending a message. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanSendMsgList (unsigned short wCard, unsigned short wBus, unsigned short wMsgCount, tCanMsg *hCanMsgList)
 Sending several messages. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanWriteByte (unsigned short wCard, unsigned short wBus, unsigned short wOffset, unsigned char bData)
 Direct writing in the CAN protocol controller. More...
 

Detailed Description

Order of call
The application must respect the sequencing according to the functions calling order.

Symbol Description
order_call_snok.png
Forbidden
order_call_sok.png
Authorized
order_call_arrow.png
Authorized and moved to followed status
Function CAN_INIT CAN_OPER CAN_BUS CAN_START
CanConfigOper
order_call_arrow.png
order_call_snok.png
order_call_snok.png
order_call_snok.png
CanConfigBus
order_call_snok.png
order_call_arrow.png
order_call_snok.png
order_call_snok.png
CanActivate
order_call_snok.png
order_call_snok.png
order_call_arrow.png
order_call_snok.png
CanDeactivate
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_arrow.png
CanSetNotification
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_snok.png
CanConfigParam
order_call_snok.png
order_call_sok.png
order_call_snok.png
order_call_snok.png
CanConfigClock
order_call_snok.png
order_call_sok.png
order_call_snok.png
order_call_snok.png
CanConfigRangeFilter
order_call_snok.png
order_call_sok.png
order_call_snok.png
order_call_snok.png
CanConfigDualFilter
order_call_snok.png
order_call_sok.png
order_call_snok.png
order_call_snok.png
CanConfigStat
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanConfigTransceiverHS
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanSelectTransceiverHS
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanConfigTransceiverLS
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanSelectTransceiverLS
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanReadTransceiverLS
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanConfigPeriodic
order_call_snok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanConfigPeriodicList
order_call_snok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanSendMsg
order_call_snok.png
order_call_snok.png
order_call_snok.png
order_call_sok.png
CanSendMsgList
order_call_snok.png
order_call_snok.png
order_call_snok.png
order_call_sok.png
CanGetEvent
order_call_snok.png
order_call_snok.png
order_call_snok.png
order_call_sok.png
CanGetBusState
order_call_snok.png
order_call_snok.png
order_call_snok.png
order_call_sok.png
CanBusOn
order_call_snok.png
order_call_snok.png
order_call_snok.png
order_call_sok.png
CanGetStat
order_call_snok.png
order_call_snok.png
order_call_snok.png
order_call_sok.png
CanReadByte
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanWriteByte
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanGetFifoRxLevels
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png
CanClearFifoRx
order_call_sok.png
order_call_sok.png
order_call_sok.png
order_call_sok.png

Function Documentation

◆ CanActivate()

_MUXSPEC tMuxStatus _MUXAPI CanActivate ( unsigned short  wCard,
unsigned short  wBus 
)

Starting communication.

This function allows communication with the network to start. After executing this function, the messages received are acknowledged and sent towards the application. The application can also send messages.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanBusOn()

_MUXSPEC tMuxStatus _MUXAPI CanBusOn ( unsigned short  wCard,
unsigned short  wBus 
)

Controller reconnection after bus off.

This function allows the user to reconnect the CAN protocol controller after switch to bus mode has been detected.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanChangeBaudRate()

_MUXSPEC tMuxStatus _MUXAPI CanChangeBaudRate ( unsigned short  wCard,
unsigned short  wBus,
tCanBus hCanBus 
)

Change the speed of the bus.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]hCanBusConfiguration parameters
Returns
Summary of the function execution

◆ CanClearFifoRx()

_MUXSPEC tMuxStatus _MUXAPI CanClearFifoRx ( unsigned short  wCard,
unsigned short  wBus 
)

Clears the reception FIFO.

This function allows to clear the reception events queue.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanCreateMsg()

_MUXSPEC tMuxStatus _MUXAPI CanCreateMsg ( unsigned short  wCard,
unsigned short  wBus,
tCanMsg hCanMsgNew 
)

Configuration of communication messages.

This function allows the user to declare the messages managed by the application.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in,out]hCanMsgNewMessage parameters
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_ERR_MSGEXCEEDToo many declared messages
See also
CanConfigParam, CanSendMsg
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_ERR_MSGEXCEED
Note
The masks allow reception of a family of identifiers (see example of CanConfigParam function). However, certain precautions must be taken:
  • In the analysis mode, the mask defined by the CanConfigParam function has priority.
  • Regardless of the mode, it is important that there is no intersection between two families. Should that be the case, the identifier would be received by the firs declared corresponding message.
In the FIFO mode analysis, it is not necessary to declare the initiating messages (service: CAN_SVC_TRANSMIT_DATA and CAN_SVC_TRANSMIT_RTR).

◆ CanDeactivate()

_MUXSPEC tMuxStatus _MUXAPI CanDeactivate ( unsigned short  wCard,
unsigned short  wBus 
)

Stopping communication.

This function stops communication with the network. After executing this function, messages are no longer received, acknowledged or sent.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanGetBusState()

_MUXSPEC tMuxStatus _MUXAPI CanGetBusState ( unsigned short  wCard,
unsigned short  wBus,
tCanChipState eCanChipState,
unsigned char *  bTxErrCount,
unsigned char *  bRxErrCount 
)

Reading CAN controller status.

This function allows the user to directly read the status of the CAN protocol controller. This function also transfers the value of the transmission and reception counters used to manage the following statuses: active error, passive error and bus off.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in,out]eCanChipStatePointer on the status of component to be completed
[in,out]bTxErrCountPointer on the transmission counter to be completed
[in,out]bRxErrCountPointer on the reception counter to be completed
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanGetEvent()

_MUXSPEC tMuxStatus _MUXAPI CanGetEvent ( unsigned short  wCard,
unsigned short  wBus,
tCanEvent hCanEvent 
)

Reading of an event.

This function allows the user to recover an event from the network.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[out]hCanEventPointer on the event
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
CanCreateMsg
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE
// Indication of event
tCanEvent hCanEvent;
tMuxStatus Status;
unsigned short wCard=0,wBus=0;
Status=CanGetEvent(wCard,wBus,&hCanEvent);
if (Status!= STATUS_OK) return;
switch(hCanEvent.eTypeEvent &~ EVENT_FIFO_OVF)
{
case EVENT_EMPTY: // No more events to be dealt with
break;
case EVENT_CAN_MSGTX: // Correct end of transmission
break;
case EVENT_CAN_MSGRX: // Correct reception
break;
case EVENT_CAN_ERROR: // Network error
break;
case EVENT_CAN_BUSCHANGE: // Change in the component's status
break;
case EVENT_CAN_BUSLOAD: // Bus charge
break;
case EVENT_TIMER: // Applicable timer
break;
case EVENT_TIMEERROR: // Loss IT time
break;
default: // Reserved for future use
break;

◆ CanGetFifoRxLevel()

_MUXSPEC tMuxStatus _MUXAPI CanGetFifoRxLevel ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wParam,
unsigned short *  wCount,
unsigned short *  wMaxCount 
)

Clears the reception FIFO.

This function allows to clear the reception events queue.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]wParamFunction's parameters
Bit 0: Type of waiting list (only for USB cases)
  • 0: Event queue is situated on the PC
  • 1: Event queue is situated on the USB case
[out]wCountNumber of event currently on waiting list
[out]wMaxCountMaximum number of events accepted on the waiting list
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanGetStat()

_MUXSPEC tMuxStatus _MUXAPI CanGetStat ( unsigned short  wCard,
unsigned short  wBus,
tCanStat hCanStat 
)

Reading statistics counters.

This function allows the user to read the network's operational counters.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in,out]hCanStatPointer on statistics Pointeur sur les statistiques
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanIsBusActive()

_MUXSPEC tMuxStatus _MUXAPI CanIsBusActive ( unsigned short  wCard,
unsigned short  wBus,
unsigned short *  wState 
)

Gives CAN controller status.

This function allows getting the activation status of a CAN bus.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[out]wStateBus status
  • 0 = Inactive
  • 1 = Active
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanReadByte()

_MUXSPEC tMuxStatus _MUXAPI CanReadByte ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wOffset,
unsigned char *  bData 
)

Direct reading of CAN protocol controller.

This function allows the user to read directly the registers of the CAN protocol controller.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-2]
[in]wOffsetReading offset
[in,out]bDataPointer on the value to be read
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE

◆ CanSendMsg()

_MUXSPEC tMuxStatus _MUXAPI CanSendMsg ( unsigned short  wCard,
unsigned short  wBus,
tCanMsg hCanMsg 
)

Sending a message.

This function allows sending a data message or a request of distant transmission.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]hCanMsgMessage parameters
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_ERR_FIFOFULLThe new message cannot be taken into account. The transmitting FIFO is full.
STATUS_ERR_BUSOFFThe new message cannot be taken into account. The CAN protocol controller is disconnected from the bus.
STATUS_ERR_MSGSVCNon supported service
STATUS_ERR_HANDLEParameter wHandleMsg is not valid
STATUS_ERR_MSGBUSYThe new message cannot be taken into account. The previous message is being transmitted.
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_ERR_FIFOFULL, STATUS_ERR_BUSOFF, STATUS_ERR_MSGSVC, STATUS_ERR_HANDLE, STATUS_ERR_MSGBUSY
Note
The masks allow reception of a family of identifiers (see example of CanConfigParam function). However, certain precautions must be taken:
  • In the analysis mode, the mask defined by the CanConfigParam function has priority.
  • Regardless of the mode, it is important that there is no intersection between two families. Should that be the case, the identifier would be received by the firs declared corresponding message.
In the FIFO mode analysis, it is not necessary to declare the initiating messages (service: CAN_SVC_TRANSMIT_DATA and CAN_SVC_TRANSMIT_RTR).

◆ CanSendMsgList()

_MUXSPEC tMuxStatus _MUXAPI CanSendMsgList ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wMsgCount,
tCanMsg hCanMsgList 
)

Sending several messages.

This function allows the sending of one or several data messages or distant transmission request.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]wMsgCountQuantity of messages to be emitted
[in]hCanMsgListTable containing the list of periodic messages
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_ERR_FIFOFULLThe new message cannot be taken into account. The transmitting FIFO is full.
STATUS_ERR_BUSOFFThe new message cannot be taken into account. The CAN protocol controller is disconnected from the bus.
STATUS_ERR_MSGSVCNon supported service
STATUS_ERR_HANDLEParameter wHandleMsg is not valid
STATUS_ERR_MSGBUSYThe new message cannot be taken into account. The previous message is being transmitted.
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_ERR_FIFOFULL, STATUS_ERR_BUSOFF, STATUS_ERR_MSGSVC, STATUS_ERR_HANDLE, STATUS_ERR_MSGBUSY

◆ CanWriteByte()

_MUXSPEC tMuxStatus _MUXAPI CanWriteByte ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wOffset,
unsigned char  bData 
)

Direct writing in the CAN protocol controller.

This function allows the user to write directly in the registers of the CAN protocol controller.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]wOffsetWriting offset
[in]bDataValue to be written
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE