linux

canGetBusParams

Syntax


#include <canlib.h>
canStatus canGetBusParams(
   int handle, 
   long* freq, 
   unsigned int* tseg1,
   unsigned int* tseg2, 
   unsigned int* sjw, 
   unsigned int* noSamp, 
   unsigned int* syncmode
);

Description

This function retrieves the current bus parameters for the specified channel.

Input Parameters

handle
An open handle to a CAN controller.
Output Parameters

freq
Bit rate (bits per second).
tseg1
Time segment 1, that is, the number of quanta from (but not including) the Sync Segment to the sampling point.
tseg2
Time segment 2, that is, the number of quanta from the sampling point to the end of the bit.
sjw
The Syncronization Jump Width; can be 1,2,3, or 4.
noSamp
The number of sampling points; can be 1 or 3.
syncmode
Unsupported, always read as zero.
Return Value

canOK (zero) if success
canERR_xxx (negative) if failure.

Related Topics

canSetBusParams

The anatomy of a CAN bit is discussed in detail at Kvaser's web site at http://www.kvaser.com.

Here are some examples of bitrate settings.