Software Library API naibrd 1.62
See all documentation at naii.docs.com
Bit Timing Functions

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBitTiming (int32_t cardIndex, int32_t module, int32_t channel, int32_t prescaler, int32_t SJW, int32_t tseg1, int32_t tseg2)
 Change the bit timing for a particular CAN module channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBitTiming (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outprescaler, int32_t *outSJW, int32_t *outtseg1, int32_t *outtseg2)
 Retrieve the bit timing for a particular CAN module channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBaudRate (int32_t cardIndex, int32_t module, int32_t channel, nai_can_baud_rate_type_t baudRate)
 Change the baud rate for a particular CAN module channel. - This function can be used in place of naibrd_CAN_SetBitTiming if you know what baud rate you want but you do not want to specify the specific bit timing parameters to achieve the desired baud rate. We will take care of determining bit timing parameters to achieve the desired baud rate.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBaudRate (int32_t cardIndex, int32_t module, int32_t channel, nai_can_baud_rate_type_t *outbaudRate)
 Retrieve the baud rate for a particular CAN module channel. NOTE: This function retrieves the value of what was last assigned using the "naibrd_CAN_SetBaudRate" function call. If baud rate was set using the naibrd_CAN_SetBitTiming, a call to naibrd_CAN_GetBaudRate will return 0 since no attempt is made to reverse calculate what the baud rate is based upon the bit timing parameters.
 

Detailed Description


Function Documentation

◆ naibrd_CAN_GetBaudRate()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBaudRate ( int32_t cardIndex,
int32_t module,
int32_t channel,
nai_can_baud_rate_type_t * outbaudRate )

Retrieve the baud rate for a particular CAN module channel. NOTE: This function retrieves the value of what was last assigned using the "naibrd_CAN_SetBaudRate" function call. If baud rate was set using the naibrd_CAN_SetBitTiming, a call to naibrd_CAN_GetBaudRate will return 0 since no attempt is made to reverse calculate what the baud rate is based upon the bit timing parameters.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
outbaudRate: (Output) Baud Rate.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_CAN_GetBitTiming()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBitTiming ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * outprescaler,
int32_t * outSJW,
int32_t * outtseg1,
int32_t * outtseg2 )

Retrieve the bit timing for a particular CAN module channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
outprescaler: (Output) Baud Rate Prescaler (valid values 0x00-0x3F).
outSJW: (Output) Synchronization Jump Width (valid values 0x0-0x3).
outtseg1: (Output) Time segment before the sample point (valid values 0x1-0xF).
outtseg2: (Output) Time segment after the sample point (valid values 0x0-0x7).
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_CAN_SetBaudRate()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBaudRate ( int32_t cardIndex,
int32_t module,
int32_t channel,
nai_can_baud_rate_type_t baudRate )

Change the baud rate for a particular CAN module channel. - This function can be used in place of naibrd_CAN_SetBitTiming if you know what baud rate you want but you do not want to specify the specific bit timing parameters to achieve the desired baud rate. We will take care of determining bit timing parameters to achieve the desired baud rate.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
baudRate: (Input) Value from nai_can_baud_rate_type_t enumeration to specify a well-known baud rate.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.
  • NAI_ERROR_TIMEOUT when baud rate configuration did not finish withing the time we were willing to wait.

◆ naibrd_CAN_SetBitTiming()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBitTiming ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t prescaler,
int32_t SJW,
int32_t tseg1,
int32_t tseg2 )

Change the bit timing for a particular CAN module channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
prescaler: (Input) Baud Rate Prescaler (valid values 0x00-0x3F).
SJW: (Input) Synchronization Jump Width (valid values 0x0-0x3).
tseg1: (Input) Time segment before the sample point (valid values 0x1-0xF).
tseg2: (Input) Time segment after the sample point (valid values 0x0-0x7).
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.
  • NAI_ERROR_TIMEOUT when baud rate configuration did not finish withing the time we were willing to wait.