PDF

AGHAF  4.3.5
Annecy electronique Generic Hardware Access Framework
CAN

API to use CAN on exxotest devices. More...

enum  AGHAF_CAN_Error {
  AGHAF_CAN_ERROR_NONE = 0, AGHAF_CAN_ERROR_STUFF, AGHAF_CAN_ERROR_FORM, AGHAF_CAN_ERROR_ACK,
  AGHAF_CAN_ERROR_BIT1, AGHAF_CAN_ERROR_BIT0, AGHAF_CAN_ERROR_CRC
}
 
enum  AGHAF_CAN_Mode { AGHAF_CAN_MODE_FD = 0x00, AGHAF_CAN_MODE_HS = 0x01, AGHAF_CAN_MODE_LS = 0x02 }
 Possible modes for CAN. More...
 
enum  AGHAF_CAN_Param {
  CAN_PARAM_MODE, CAN_PARAM_BAUDRATE, CAN_PARAM_BAUDRATE_FD, CAN_PARAM_SAMPLEPOINT,
  CAN_PARAM_SAMPLEPOINT_FD, CAN_PARAM_SYNCJUMP_WIDTH, CAN_PARAM_SYNCJUMP_WIDTH_FD, CAN_PARAM_LISTEN_ONLY,
  CAN_PARAM_TERMINATION, CAN_PARAM_TERMINATION_LS, CAN_PARAM_NO_EVENT
}
 List of parameters used to configure a CAN bus. More...
 
#define AGHAF_CAN_PERIODIC_NO_RESTART   (1<<0)
 Don't restart period.
 
enum  AGHAF_CAN_IdentifierType { AGHAF_CAN_IdStd, AGHAF_CAN_IdXtd }
 
typedef void * AGHAF_CAN_Bus
 

Detailed Description

API to use CAN on exxotest devices.

Usage Example

Call order and priority

Device is in "init" state at startup.

The following section describes state management:

Symbol Description
Forbidden
Authorized
Followed status
Function Config Active
AGHAF_CAN_getBus
AGHAF_CAN_getBusCount
AGHAF_CAN_registerCallback
AGHAF_CAN_deregisterCallback
AGHAF_CAN_Bus_getParam
AGHAF_CAN_Bus_setParam
AGHAF_CAN_Bus_supportedModes
AGHAF_CAN_Bus_addFilter
AGHAF_CAN_Bus_clearFilters
AGHAF_CAN_Bus_filtersCount
AGHAF_CAN_Bus_reject
AGHAF_CAN_Bus_supportedFilters
AGHAF_CAN_Bus_activate
AGHAF_CAN_Bus_deactivate
AGHAF_CAN_Bus_isActivated
AGHAF_CAN_Bus_supportedTerminations
AGHAF_CAN_Bus_supportedTerminationsLs
AGHAF_CAN_Bus_state
AGHAF_CAN_Bus_BusOn
AGHAF_CAN_sendFrame
AGHAF_CAN_Bus_sendPeriodic
AGHAF_CAN_Bus_getPeriodicCount

Typedef Documentation

◆ AGHAF_CAN_Bus

Handle to a CAN bus.

Enumeration Type Documentation

◆ AGHAF_CAN_Error

Enumerator
AGHAF_CAN_ERROR_NONE 

No error.

AGHAF_CAN_ERROR_STUFF 

More than 5 equal bits in a sequence have occurred in a part of a received message where this is not allowed.

AGHAF_CAN_ERROR_FORM 

A fixed format part of a received frame has the wrong format.

AGHAF_CAN_ERROR_ACK 

The message transmitted by the device was not acknowledged by another node.

AGHAF_CAN_ERROR_BIT1 

Device tried to send a recessive level but the monitored bus value was dominant.

AGHAF_CAN_ERROR_BIT0 

Device tried to send a dominant level but the monitored bus value was recessive.

AGHAF_CAN_ERROR_CRC 

The CRC check sum of a received message was incorrect.

◆ AGHAF_CAN_IdentifierType

Enumerator
AGHAF_CAN_IdStd 

Standard 11 bit identifier.

AGHAF_CAN_IdXtd 

Extended 29 bit identifier.

◆ AGHAF_CAN_Mode

Possible modes for CAN.

Enumerator
AGHAF_CAN_MODE_FD 

CAN FD

Enable CAN High Speed and FD transmition and reception.
Use CAN High Speed and FD termination settings (CAN_PARAM_TERMINATION).

AGHAF_CAN_MODE_HS 

CAN High Speed

Enable CAN High Speed transmition and reception.
Use CAN High Speed and FD termination settings (CAN_PARAM_TERMINATION).

AGHAF_CAN_MODE_LS 

CAN Low Speed

Enable CAN Low Speed transmition and reception.
Use CAN Low Speed termination settings (CAN_PARAM_TERMINATION_LS).

◆ AGHAF_CAN_Param

List of parameters used to configure a CAN bus.

Enumerator
CAN_PARAM_MODE 

CAN mode settings.

Use: AGHAF_CAN_Mode
Default: AGHAF_CAN_MODE_FD

CAN_PARAM_BAUDRATE 

Nominal CAN baudrate in bps

Max: 1000000 bps (1 Mbps)
Default: 500000 bps (500 kbps)

CAN_PARAM_BAUDRATE_FD 

Baudrate to be used during the high bitrate phase of CAN FD frame

Max: 5000000 bps (5 Mbps)
Default: 1000000 bps (1 Mbps)

CAN_PARAM_SAMPLEPOINT 

Desired bit sample point as a percentage of the bit time

Range: [0, 100] %
Default: 80 %

CAN_PARAM_SAMPLEPOINT_FD 

Desired bit sample point as a percentage of the bit time
to be used during the high bitrate phase of CAN FD frame

Range: [0, 100] %
Default: 80 %

CAN_PARAM_SYNCJUMP_WIDTH 

Desired synchronization jump bit has a percentage of bit time

Range: [0, 100] %
Default: 15 %

CAN_PARAM_SYNCJUMP_WIDTH_FD 

Desired synchronization jump bit has a percentage of bit time
to be used during the high bitrate phase of CAN FD frame

Range: [0, 100] %
Default: 15 %

CAN_PARAM_LISTEN_ONLY 

Enable listen only mode.
CAN controler will no longer acknowledge received frames.

Range: [0, 1]
Default: 0 (disabled)

CAN_PARAM_TERMINATION 

CAN High Speed and FD termination settings.
Use one of the value returned by supported CAN termination function.

0 no termination
Default: 0 (no termination)

CAN_PARAM_TERMINATION_LS 

CAN Low Speed termination settings.
Use one of the value returned by supported CAN Low Speed termination function.

0 no termination
Default: 0 (no termination)

CAN_PARAM_NO_EVENT 

Disable CAN events reporting.
This will significantly reduce the load on the USB bus if you don't need these events.
Protocols requiring CAN will continue to function normally (e.g. DoCAN).

Range: [0, 1]
Default: 0 (report CAN events)