When a numeric baud rate (e.g. 500000) is provided to
ADCS, the default
XNET bit timings will be used, which may not be compatible with some CAN bus configurations.
With CAN FD, it is critical that the bit timing settings match for all nodes on the bus, most importantly the resulting
baud rates and the
sample points. In case of mismatch, communication might be unreliable or not work at all. Using NI-XNET’s custom baud rates allows configuration of these settings.
LabVIEW API
To use custom baud rates with
Open Diagnostic on CAN FD.vi, you need to set the inputs Baud Rate, FD Baud Rate and IO Mode using the steps listed below.
- First, generate the custom baud rates values (for both nominal and FD baud rate) for your bit timing requirements according to this document: Error or Incorrect Frames When Using NI-XNET in CAN FD & BRS .
- Set Baud Rate to the generated custom nominal baud rate. This is the baud rate used for CAN 2.0 and CAN FD frames, and during the CAN FD+BRS frame arbitration phase.
- Set FD Baud Rate to the generated custom FD baud rate. This is the baud rate used during the CAN FD+BRS frame data phase.
- Set IO Mode to CAN FD+BRS to enable using the FD Baud Rate. This parameter controls which kind of CAN frames ADCS sends to the ECU.
- Optionally, change Max DLC to an appropriate number. Max DLC is the maximum CAN FD frame payload length to be transmitted to the ECU by ADCS, the default is 8 bytes. Independent from this setting, the ECU may respond with any valid frame payload length. Frame padding can be configured using the property Fill CAN Frames via Diag Set Property.vi.
Note: To enter the hexadecimal custom baud rate in LabVIEW, follow these instructions:
- Right-click the baud rate constant or control and select Properties.
- On the Display Format tab, change Type to Hexadecimal.
- Click OK.
- Now, you can enter the hexadecimal value into the constant or control.
C APIWhen using the ADCS C API, the process is the same as in LabVIEW. The values are used as parameters of the function
ndOpenDiagnosticOnCanFD.
Additional InformationA custom baud rate is a 64-bit integer, which encodes the bit timings used by the CAN controller. For more information, refer to this document:
Error or Incorrect Frames When Using NI-XNET in CAN FD & BRS or the NI-XNET help.