I-7188XBD-CAN/μPAC-7186EXD-CAN user manual (ver.1.0.3, May/09/2014)
47
3.1.22 CAN_SearchBaud
Description:
Enter
“Listen Only Mode” and enable receive and error interrupt to
detect the right bit-rate of the CAN bus. Upon successful reception of a
message, the
“CAN_NoError” message will be return. Otherwise, the
“CAN_AutoBaudTimeout” message will be return
Syntax:
int CAN_SearchBaud(unsigned long CANBaud, char BT0,
char BT1,unsigned int Timeout)
Parameter:
CANBaud: Use a long int to set this parameter. For example, if
users want to set CAN baud to 125K bps. Use the value 125000UL.
BT0, BT1: Set the special user-defined baud rate. Users can set
arbitrary baud with these parameters. But users need to have the
background of SJA1000 CAN controller and 82C251 CAN
transceiver, and calculate the values of BT0 and BT1 by
themselves (The clock frequency of CAN controller is 16MHz.)
Timeout: Set the timer for search a necessary CAN bus baud rate.
Return:
CAN_NoError: OK.
CAN_ResetError:
Fail to reset the CAN controller.
CAN_ConfigError: Fail to Configure the CAN controller register.
CAN_SetBaudRateError:
Fail to set the CAN baud rate.
CAN_BaudNotSupport: The baud rate is not support.
CAN_AutoBaudTimeout: Can
’t find the necessary CAN bus baud rate.
Relative function:
None