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 phy.can.phy.mode

Configures how the device interacts with the CAN-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.

Type

Default

Options

integer

0

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

Automatic retransmission phy.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

Bit-rate configuration mode phy.can.phy.bit_rate_cfg_mode

Configures how the CAN-bus bit-rate is set. Bit-rate supports all standard bit-rates. Non-standard bit-rate configuration can be set using Bit-timing.

Type

Default

Options

integer

0

Bit-rate (simple): 0 Bit-timing (advanced): 1


Configuration explained

This section contains additional information and examples.


Retransmission

The retransmission configures how the CANmod.input 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 controller is set to 40 MHz.

The bit-rate mode Bit-rate (simple) supports the following list of bit-rates[1]:

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 bit-rate 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 = 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}\)


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 CANmod.input 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 CANmod.input becomes:

  • BRP: 1

  • SEG1: 14

  • SEG2: 5