Solution
NI-XNET hardware uses a 40 MHz clock for CAN and CAN FD communication. This corresponds to a time quantum of 25 ns, which defines the smallest unit used to build the CAN bit time.
Bit timing parameters such as TSEG1, TSEG2, and SJW are expressed in multiples of this time quantum. The actual time represented by each segment is obtained by multiplying the number of time quanta by 25 ns. Additionally, NI-XNET internally interprets several timing parameters as one greater than the configured value.
When comparing with third-party hardware such as Vector devices, differences arise because those devices may use a different clock rate, commonly 80 MHz. As a result, timing parameters must be adapted to match the 40 MHz time base used by NI-XNET hardware.
Use the following relationships to interpret and convert timing parameters:
- Time Quantum (Tq) = 25 ns
- Actual TSEG1 time = (TSEG1 + 1) × Tq
- Actual TSEG2 time = (TSEG2 + 1) × Tq
- Total bit time = (1 + TSEG1 + TSEG2) × Tq
To illustrate how to translate timing parameters from Vector to NI-XNET, consider the following example Vector configuration:
| Parameter | Value |
| CanControllerBaudRate | 500k |
| CanControllerPropSeg | 47 |
| CanControllerSeg1 | 16 |
| CanControllerSeg2 | 16 |
| CanControllerSyncJumpWidth | 16 |
| CanBrp | 1 |
The conversion is performed by applying the NI-XNET relationships to the Vector parameters. First, combine the Vector segments:
- TSEG1 = PropSeg + Seg1 = 47 + 16 = 63
- TSEG2 = Seg2 = 16
- SJW = 16
Then apply the NI-XNET parameter interpretation:
- TSEG1 = 63 - 1 = 62
- TSEG2 = 16 - 1 = 15
- SJW = 16 - 1 = 15
Based on these calculations, the equivalent NI-XNET configuraiton is:
| Parameter | Vector Value | NI-XNET Value |
| Baud Rate | 500k | 500k |
| BRP | 1 | 1 |
| TSEG1 | 47 | 62 |
| TSEG2 | 16 | 15 |
| SJW | 16 | 15 |
These adjustments account for the fact that NI-XNET interprets configured timing parameters as the programmed value plus one. When converting from hardware using a different clock rate, additional scaling may be required to match the NI-XNET 40 MHz time base.
If an exact match is not possible, configure a custom baud rate using the NI-XNET Database Editor and iteratively adjust the timing parameters until the desired baud rate and sample point are achieved. For example, you can modify an existing .dbc file, set the baud rate to Custom, and refine the parameters while verifying the resulting timing.