Documentation PDF

MUXDLL  V6.55
CAN Configuration

Functions

_MUXSPEC tMuxStatus _MUXAPI CanConfigBus (unsigned short wCard, unsigned short wBus, tCanBus *hCanBus)
 Configuration of bus parameters. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigClock (unsigned short wCard, unsigned short wBus, tCanClockFreq eCanClock)
 Set up the CAN controller clock. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigDualFilter (unsigned short wCard, unsigned short wBus, tCanDualFilter *hCanDualFilter)
 Configuration of double acceptance filter. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigOper (unsigned short wCard, unsigned short wBus, tCanOper *hCanOper)
 Routines' operation mode. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigParam (unsigned short wCard, unsigned short wBus, tCanParam *hCanParam)
 Configuration of supplementary parameters. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigPeriodic (unsigned short wCard, unsigned short wBus, unsigned short wOffset, unsigned short wParam, tCanMsg *hCanMsgNew)
 Programming a periodic message. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigPeriodicList (unsigned short wCard, unsigned short wBus, unsigned short wPeriodicCount, tCanPeriodicMsg *hPeriodicCanMsgList)
 Programming a periodic messages list. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigRangeFilter (unsigned short wCard, unsigned short wBus, tCanRangeFilter *hCanRangeFilter)
 Setting of a range of acceptance. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigStat (unsigned short wCard, unsigned short wBus, unsigned short wBusLoadTime)
 Configuration of statistics. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigTerminationLS (unsigned short wCard, unsigned short wBus, unsigned short wValue)
 Configuration of pull-up resistors from CAN LS networks. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigTransceiverHS (unsigned short wCard, unsigned short wBus, tCanSlope eCanSlope)
 Configuration of signal slope. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanConfigTransceiverLS (unsigned short wCard, unsigned short wBus, unsigned short wStandBy, unsigned short wEnable, unsigned short wWakeUp)
 Configuration of low speed line interface. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanReadTransceiverLS (unsigned short wCard, unsigned short wBus, unsigned short *wLineState)
 LS transceiver status reading. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanSelectTransceiverHS (unsigned short wCard, unsigned short wBus, tCanType eCanType)
 Configuration of type of line interface. More...
 
_MUXSPEC tMuxStatus _MUXAPI CanSetNotification (unsigned short wCard, unsigned short wBus, void *hWinEvent)
 Declaration of the application event. More...
 

Detailed Description

Function Documentation

◆ CanConfigBus()

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

Configuration of bus parameters.

This function can configure all the parameters of the bus.
The baud rate is calculated as follows: (8MHz/((1+TSEG1+TSEG2)*BRP))
The sampling point is calculated as follows: (1+TSEG1)(1+TSEG1+TSEG2)
Example: A 250 kbit/sec baudrate with an 81% sampling point: BRP=2, TSEG1=12, TSEG2=3

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]hCanBusBus parameter
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

◆ CanConfigClock()

_MUXSPEC tMuxStatus _MUXAPI CanConfigClock ( unsigned short  wCard,
unsigned short  wBus,
tCanClockFreq  eCanClock 
)

Set up the CAN controller clock.

This function indicates to the dll the operating frequency of the associated device's CAN controller.
Controller SJA1000: 16 MHZ frequency, Controller TWINCAN: 40 MHZ frequency.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]eCanClockFrequency settings
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_WARNINGCard not supported
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_WARNING
Warning
In case this function is not called, only the card's compatible settings will be valid.

◆ CanConfigDualFilter()

_MUXSPEC tMuxStatus _MUXAPI CanConfigDualFilter ( unsigned short  wCard,
unsigned short  wBus,
tCanDualFilter hCanDualFilter 
)

Configuration of double acceptance filter.

This function uses CAN PHILIPPS SJA1000's protocol controller's capacity to define 2 different acceptance filters.

  • For standard identifiers, the filters are placed on the whole of the identifier (11 bits)
  • For extended identifiers, the filters are place on the identifier's first 2 bytes (16 bits of 29) This function must be called after the CanConfigParam function and it replaces the acceptance filter defined by the latter.
Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]hCanDualFilterFilter configuration
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
CanConfigParam
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE
Note
The acceptance filter allows application of a message selection filter for messages coming from the networks in order to limit the charge on the PC. This filter has priority over the rest of filters.
An identifier is received if the following condition applies:
(Identificateur reçu AND type AND Masque) = (wFiltIdent1 AND type AND dwFiltMask1) OR (wFiltIdent2 AND type AND dwFiltMask2)

◆ CanConfigOper()

_MUXSPEC tMuxStatus _MUXAPI CanConfigOper ( unsigned short  wCard,
unsigned short  wBus,
tCanOper hCanOper 
)

Routines' operation mode.

This function determines the interface mode between the application and the card.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]hCanOperType of interface with the application
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

◆ CanConfigParam()

_MUXSPEC tMuxStatus _MUXAPI CanConfigParam ( unsigned short  wCard,
unsigned short  wBus,
tCanParam hCanParam 
)

Configuration of supplementary parameters.

This function allows configuration of additional operational parameters.
For a card with a CAN PHILIPS SJA1000 protocol controller, the messages received by the controller are analyzed and then placed in the corresponding buffer. This function allows the user, among other things, to parameterise the controller's acceptance filter so as to reduce the number of messages received from the network, aiming to improve the system's performance.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]hCanParamAuxiliary operation parameters
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
Note
The acceptance filter allows application of a message selection filter for messages coming from the network in order to limit the charge on the PC. This filter has priority over the rest of filters.
An identifier is received if the following condition applies:
(Received identifier AND type AND Mask) = (Programmed identifier AND type AND Mask)
For example:
  1. Programmed ident = xxx, mask = 000 allows reception of all identifiers
  2. Programmed ident = xxx, mask = 7FF allows reception of xxx identifier only
  3. Programmed ident = 001, mask = 001 allows reception of all odd identifiers

◆ CanConfigPeriodic()

_MUXSPEC tMuxStatus _MUXAPI CanConfigPeriodic ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wOffset,
unsigned short  wParam,
tCanMsg hCanMsgNew 
)

Programming a periodic message.

This function allows the user to start, stop and update the emission of periodic messages.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]wOffsetIndex of periodic message [0-15]. The application is composed of 16 periodic messages. This parameter corresponds to the message index the application wants to access. Note that the 16 messages are dealt with independently.
[in]wParamMessage parameter
  • Bit 0: Indicator of periodic message in operation
    • 0: The periodic message is stopped
    • 1: The periodic message is activated (start of periodicity or update)
  • Bit 1: Indicates transference of transmissions endings. It is not always necessary for an application to receive the events of transmission endings related to the emission of periodic messages.
    • 0: The transmissions endings are not transferred to the applications
    • 1: The transmissions endings are transferred to the application
[in]hCanMsgNewMessage parameters
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_ERR_MSGSVCService not supported
STATUS_ERR_MSGEXCEEDWrong message offset
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_ERR_MSGSVC, STATUS_ERR_MSGEXCEED

◆ CanConfigPeriodicList()

_MUXSPEC tMuxStatus _MUXAPI CanConfigPeriodicList ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wPeriodicCount,
tCanPeriodicMsg hPeriodicCanMsgList 
)

Programming a periodic messages list.

This function allows the start, stop and update of a periodic messages list mission.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]wPeriodicCountQuantity of periodic contained in the table
[in]hPeriodicCanMsgListTable containing the list of periodic frames
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_ERR_MSGEXCEEDWrong message offset
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_ERR_MSGEXCEED

◆ CanConfigRangeFilter()

_MUXSPEC tMuxStatus _MUXAPI CanConfigRangeFilter ( unsigned short  wCard,
unsigned short  wBus,
tCanRangeFilter hCanRangeFilter 
)

Setting of a range of acceptance.

This function allows to define an identifiers range to besent back to the application. The range will be continued between both defined identifiers.
This function must be called after the CanConfigParam function and replaces the acceptance filter previously definied by it.

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

◆ CanConfigStat()

_MUXSPEC tMuxStatus _MUXAPI CanConfigStat ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wBusLoadTime 
)

Configuration of statistics.

This function allows configuration of the duration on which the bus charge is calculated. Duration of 0 inhibits the charge calculation.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]wBusLoadTimeThis parameter defines the duration on which the bus charge is calculated. It is expressed in ms. Value: 0 indicates that no bus charge has been transferred to the application. The bus charge is transferred in FIFO mode by means of the event EVENT_CAN_BUSLOAD and of the wBusLoad parameter (0 by default).
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

◆ CanConfigTerminationLS()

_MUXSPEC tMuxStatus _MUXAPI CanConfigTerminationLS ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wValue 
)

Configuration of pull-up resistors from CAN LS networks.

This function allows the user to parameterise the different values of the pull-up resistors on the CANLS line interface. These resistor values have an influence on the network's total impedance and consequently on the transition slopes when going from recessive to dominant on CANH and CANL lines.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]wValueValue of the pull-up resistor
  • wValue=0 Approximately 15 Ko resistor (6.8 Ko for MUX-4C4L/6C6L)
  • wValue=1 Approximately 6 Ko resistor(2.2 Ko for MUX-4C4L/6C6L)
  • wValue=2 Approximately 1,3 Ko resistor(1.6 Ko for MUX-4C4L/6C6L)
  • wValue=3 Approximately 0,5 Ko resistor
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_ERR_WARNINGThis type of material is not supported
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_ERR_WARNING
Note
A CANLS network's total impedance must always be below 1Ko.
This function is only available on the first CAN channelof USB-MUX-4C2L casesand on all CAN channels of MUX-4C4L and MUX-6C6L cases.

◆ CanConfigTransceiverHS()

_MUXSPEC tMuxStatus _MUXAPI CanConfigTransceiverHS ( unsigned short  wCard,
unsigned short  wBus,
tCanSlope  eCanSlope 
)

Configuration of signal slope.

This function controls signal slope on CAN high and CAN low lines.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]eCanSlopeSlope between low and high level
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

◆ CanConfigTransceiverLS()

_MUXSPEC tMuxStatus _MUXAPI CanConfigTransceiverLS ( unsigned short  wCard,
unsigned short  wBus,
unsigned short  wStandBy,
unsigned short  wEnable,
unsigned short  wWakeUp 
)

Configuration of low speed line interface.

This function allows the user to control the different control signals from the CAN low speed (fault tolerant) line interface.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]wStandByValue of «stand by» pin [0-1]
[in]wEnableValue of «enable» pin [0-1]
[in]wWakeUpValue of «wake up» pin [0-1]
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_ERR_WARNINGThis type of material is not supported
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_ERR_WARNING

◆ CanReadTransceiverLS()

_MUXSPEC tMuxStatus _MUXAPI CanReadTransceiverLS ( unsigned short  wCard,
unsigned short  wBus,
unsigned short *  wLineState 
)

LS transceiver status reading.

This function allows to read the logical level of INH and ERR pins of the CAN low speed (fault tolerant) tranceiver.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[out]wLineStateTranceiver's status
  • Bit 0: ERR line's status
  • Bit 1: INH line's status
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

◆ CanSelectTransceiverHS()

_MUXSPEC tMuxStatus _MUXAPI CanSelectTransceiverHS ( unsigned short  wCard,
unsigned short  wBus,
tCanType  eCanType 
)

Configuration of type of line interface.

This function allows selection of type of bus line interface.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]eCanTypeType of line interface
  • CAN_TRUE: high speed interface (by default)
  • CAN_FALSE: low speed interface (fault tolerant)
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
STATUS_WARNINGCard not supported
See also
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE, STATUS_ERR_BOARD

◆ CanSetNotification()

_MUXSPEC tMuxStatus _MUXAPI CanSetNotification ( unsigned short  wCard,
unsigned short  wBus,
void *  hWinEvent 
)

Declaration of the application event.

This function allows the application to use the task synchronisation methods provided by the Windows operation systems (API WIN32). This function allows transference of an event handle created by the Windows function «CreateEvent» to the DLL. This event is used during communication when an event is transferred from the DLL to the application (for example: end of transmission ending, reception, an error...).From then on, the application can wait for events through waiting functions such asWaitForSingleObject or WaitForMultipleObject.

Parameters
[in]wCardIndex of card number to be accessed
[in]wBusIndex of bus number [0-x]
[in]hWinEvent«handle» indicated by the CreateEvent function
Returns
Summary of the function execution
Return values
STATUS_OKSuccess
STATUS_ERR_PARAMParameters error
STATUS_ERR_SEQUENCESequences error
See also
CreateEvent
STATUS_OK, STATUS_ERR_PARAM, STATUS_ERR_SEQUENCE
// Request for indication of event
HANDLE hWinEvent;
tCanEvent hCanEvent;
tMuxStatus Status;
unsigned short wCard=0,wBus=0;
hWinEvent=CreateEvent(NULL,FALSE,FALSE,NULL);
if(hWinEvent== NULL) return;
Status=CanSetNotification(wCard,wBus,hWinEvent);
if(Status!= STATUS_OK) return;
Status=CanActivate(wCard,wBus);
if(Status!= STATUS_OK) return;
if(WaitForSingleObject(hWinEvent,INFINITE) == WAIT_OBJECT_0)
{
CanGetEvent(wCard,wBus,&hCanEvent);
}