Physical

This page documents the Physical (PHY) configuration.

The Physical section configures parameters related to the CAN-bus.


Configuration file fields

This section is autogenerated from the Rule Schema file.

Mode can.phy.mode

Device CAN bus mode. Configures how the device interacts with the bus. In Normal mode, the device can receive, acknowledge and transmit frames. In Restricted mode, the device can receive and acknowledge, but not transmit frames. In Bus Monitoring mode, the device can receive, but not acknowledge or transmit frames. It is recommended to always use the most restrictive mode possible.

Type

Default

Options

integer

1

Normal (receive, acknowledge and transmit): 0 Restricted (receive and acknowledge): 1 Monitoring (receive only): 2

Automatic retransmission can.phy.retransmission

Retransmission of frames that have lost arbitration or that have been disturbed by errors during transmission.

Type

Default

Options

integer

1

Disable: 0 Enable: 1

CAN FD specification can.phy.fd_spec

Configures the CAN FD specification used by the device. Shall match the specification used by the CAN bus network.

Type

Default

Options

integer

0

ISO CAN FD (11898-1): 0 non-ISO CAN FD (Bosch V1.0.): 1

Bit-rate configuration mode can.phy.bit_rate_cfg_mode

Configures how the CAN bus bit-rate is set. Modes Auto-detect and Bit-rate support all standard bit-rates. Non-standard bit-rate configuration can be set using Bit-timing. It is recommended to set the bit-rate manually if it is known.

Type

Default

Options

integer

0

Auto-detect: 0 Bit-rate (simple): 1 Bit-timing (advanced): 2


Configuration explained

This section contains additional information and examples.

Mode

The mode field configures to what extend the CANedge is allowed to communicate on the CAN-bus.

Note

It is recommended to use the most restrictive mode possible.


Retransmission

The retransmission configures how the CANedge should react when message transmissions fail. Failed transmissions can either be aborted or retried.


Bit-rate configuration mode

The bit_rate_cfg_mode, selects how the bit-rate is configured. In most cases, a simple bit-rate can be set. For more advanced cases, the more extensive bit-timing can be used.


Bit-rate / bit-timing

The input clock to the CAN-bus controllers is set to 40 MHz (480 MHz prescaled by 12).

The bit-rate modes Auto-detect and Bit-rate (simple) support the following list of bit-rates12:

Bitrate

BRP

Quanta

Seg1

Seg2

SJW

5k

100

80

63

16

4

10k

50

80

63

16

4

20k

25

80

63

16

4

33.333k

10

120

95

24

4

47.619k

8

105

83

21

4

50k

10

80

63

16

4

83.333k

4

120

95

24

4

95.238k

4

105

83

21

4

100k

5

80

63

16

4

125k

4

80

63

16

4

250k

2

80

63

16

4

500k

1

80

63

16

4

800k

1

50

39

10

4

1M

1

40

31

8

4

2M

1

20

15

4

4

4M

1

10

7

2

2

In Auto-detect mode, the device attempts to determine the bit-rate from the list of detectable bit-rates. Depending on factors such as data patterns, bit-rate deviation etc. it may not always be possible to detect the bit-rate automatically.

Warning

It is recommended to set the bit-rate manually when possible

Warning

Bit-rate auto-detect cannot be used to detect a CAN FD switched bit-rate

In mode Bit-timing (advanced), the bit-rate timing can be set directly. The following equations can be used to calculate the bit-timing fields:

  • Input clock: \(CLK = \frac{480000000}{12} = 40000000 = 40\text{ MHz}\)

  • Quanta: \(Q = 1 + SEG_1 + SEG_2\)

  • Bit-rate: \(BR = \frac{CLK/BRP}{Q}\)

  • Sample point: \(SP = 100 \cdot \frac{1 + SEG_1}{Q}\)


Sample point calculator

Below calculator can be used to search for bit-timing configurations matching a specific sample-point. The calculator takes the following inputs:

  • Type: Standard (SD) or FD (FD) bit-timing

  • BR: Bit-rate

  • SP-TARGET: Sample-point target percentage

  • SP-TOLERANCE: Sample-point tolerance percentage (increase to include more results)

Type: BR: SP-TARGET: SP-TOLERANCE:


Examples

Example: Matching bit-timing settings based on different input clock frequency (CLK).

Settings to match (based on a 80 MHz input clock):

  • Bit-rate: 2M

  • Quanta: 40

  • SEG1: 29

  • SEG2: 10

  • Sample point: 75%

Above settings are based on an input clock with frequency:

\[CLK = BR \cdot Q = 2000000 \cdot 40 = 80\text{ MHz}\]

The CANedge uses a 40 MHz input clock. To obtain a bit-rate of 2 M with a 40 MHz input clock, the number of quanta is calculated as:

\[Q = \frac{CLK/BRP}{BR} = \frac{40000000/1}{2000000} = 20\]

To obtain a sampling point of 75%, SEG1 is calculated as:

\[SEG_1 = \frac{SP \cdot Q}{100} - 1 = \frac{75 \cdot 20}{100} = 14\]

Now, SEG2 is calculated as:

\[SEG_2 = Q - SEG_1 - 1 = 20 - 14 - 1 = 5\]

The equivalent bit-timing settings using the 40 MHz input clock of the CANedge becomes:

  • BRP: 1

  • SEG1: 14

  • SEG2: 5


1

All bit-rate configurations use a Sample-Point (SP) of 80%.

2

The CAN-FD Secondary-Sample-Point (SSP) is set to the same as the CAN-FD Sample-Point (SP).