# 如何计算CAN通讯的采样率？

Level 3
Level 3

HI，expert：

1.这里的“.samplePoint = 8000,”是什么意思，为何设置8000，意味着采样点是80%？

2.一般同步段长度不都是1Tq吗？这里怎么设置“.syncJumpWidth = 3”，是基于什么考虑？

3.按照上述设置的参数，计算采样点是按照（syncJumpWidth+timeSegment1）/(syncJumpWidth+timeSegment1+timeSegment2)=(3+3)/(3+3+10)=37.5%,这显然不对吧？

1 Solution
Attachments are accessible only for community members.

Moderator
Moderator

10 Replies

# Re: 如何计算CAN通讯的采样率？

Moderator
Moderator

Only utilize the samplePoint when the parameter `calculateBittimingValues` is set to true. If set to false, the samplePoint will not be used. You can perform debugging and tracing on the function IfxCan_Node_setBitTiming().

Level 3
Level 3

# Re: 如何计算CAN通讯的采样率？

Moderator
Moderator

TSEG1 = 10 = PROP_SEG + PHASE_SEG1

TSEG2 = 3 = PHASE_SEG2

SYNC_SEG = 1

The length of the bit time is calculated as follows: Bit Time Length = (10 + 1) + (3 + 1) + 1 = 16

Assuming an 8MHz CAN clock, the bitrate is determined to be 500 kbit/s.

1 /    (1 / 8000000 *16)   = 8 000 000 / 16 = 500 000 bit/s

Level 3
Level 3

Level 3
Level 3

# Re: 如何计算CAN通讯的采样率？

Moderator
Moderator

The power supply should be 7~14V,  please see this user manual of the kit.https://www.infineon.com/dgdl/Infineon-AURIX_TC334_lite_Kit-UserManual-v01_00-EN.pdf?fileId=8ac78c8c...

Please see this sentence: The AURIX™ TCxx4 lite Kit must be supplied by an external DC power supply, this can be done via the DC plug X3 (recommended voltage range +7 V…+14 V) or  via the Micro USB plug X4 (+5 V)

The relation is 'OR'.

Attachments are accessible only for community members.

# Re: 如何计算CAN通讯的采样率？

Level 3
Level 3

1.添加引脚定义：

``````    /* Select the port pins for can communication */
const IfxCan_Can_Pins Can0Pins = {
&IfxCan_TXD00_P20_8_OUT, IfxPort_OutputMode_pushPull,   /* Tx Pin */
&IfxCan_RXD00B_P20_7_IN, IfxPort_InputMode_pullUp,      /* Rx Pin */
};

g_mcmcan.canNodeConfig.pins = &Can0Pins;                   /* Assign Slave port pins  */``````

2.修改“Loopbcak”为“False”:

``````    g_mcmcan.canNodeConfig.busLoopbackEnabled = FALSE;
``````

Attachments are accessible only for community members.

Moderator
Moderator

# Re: 如何计算CAN通讯的采样率？

Level 3
Level 3

Attachments are accessible only for community members.

Level 3
Level 3

Di_W，你好！