Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Jonson
Level 3
Level 3
25 replies posted 25 sign-ins 5 questions asked

HI,expert:

在TC334的例程中看到这样的代码:

Jonson_0-1701833750080.png

 

我感到奇怪的是:

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

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

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

希望能够得到英飞凌工程师的回复,谢谢!

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Di_W
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 100 likes received

TC3xx的CAN的修改,除了关闭loopback之外还需要一点设置,附件供您参考。ADS的watch功能可以先试一下全局变量,对于寄存器在register中可以看到值。

View solution in original post

0 Likes
10 Replies
Di_W
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 100 likes received

只是在自动计算timing时才需要用samplePoint,可以设断点跟到下面函数中,即可看到实际设置的值。

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().

Di_W_0-1701848707829.png

 

0 Likes
Jonson
Level 3
Level 3
25 replies posted 25 sign-ins 5 questions asked

你好!感谢你的耐心回复。那么假如calculateBittimingValues 设置为0,是不是上述的配置我理解起来就是采样率=(NTSEG1 + 2)/ (NTSEG1 + NTSEG2 + 3) * 100%=(3+2)/(3+3+10)*100%=31.25%

 

0 Likes
Di_W
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 100 likes received

下面的例子来自于User Manual中DBTPi寄存器的定义,可以自行换算一下(参考资料)。

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

Di_W_0-1701854957946.png

 

0 Likes
Jonson
Level 3
Level 3
25 replies posted 25 sign-ins 5 questions asked

谢谢你的回复,我理解了。这样换算下来,我上面的采样率应该就是31.25%

你的采样率应该是75%吧

0 Likes
Jonson
Level 3
Level 3
25 replies posted 25 sign-ins 5 questions asked

你好,我想再问一下,是不是用英飞凌官方TC334 lite Kit板子调试CAN通讯一定要给这里的5V通电:

微信图片_20231207141118.png

0 Likes
Di_W
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 100 likes received

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'.

 

0 Likes
lock attach
Attachments are accessible only for community members.
Jonson
Level 3
Level 3
25 replies posted 25 sign-ins 5 questions asked

你好!此外我还有一个问题需要向你请教,我想使用英飞凌的CAN通讯例程“MCMCAN_1_KIT_TC334_LK”修改形成自己能实际运用到电机控制中的CAN通讯,我主要修改点如下:

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 */
          IfxPort_PadDriver_cmosAutomotiveSpeed3                  /* Pad driver mod*/
      };

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

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

    g_mcmcan.canNodeConfig.busLoopbackEnabled = FALSE;

 

做出以上修改后,我的CAN通讯并未调通,而且发送中断似乎并未进入。如附件所示,是我的工程文件,请帮忙看一下,谢谢!

另外,我发现“AURix Development Studio”在debug代码时,我在“expression”中添加变量,不管添加什么变量,似乎也识别不到变量,是否是我的“AURix Development Studio”没有设置好?

微信图片_20231208133533.png

 

0 Likes
lock attach
Attachments are accessible only for community members.
Di_W
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 100 likes received

TC3xx的CAN的修改,除了关闭loopback之外还需要一点设置,附件供您参考。ADS的watch功能可以先试一下全局变量,对于寄存器在register中可以看到值。

0 Likes
Jonson
Level 3
Level 3
25 replies posted 25 sign-ins 5 questions asked

您好!我按照你上述的附件进行修改,但是我发现还是无法进入到发送中断,我感觉可能还有其他地方的需要修改。

0 Likes
lock attach
Attachments are accessible only for community members.
Jonson
Level 3
Level 3
25 replies posted 25 sign-ins 5 questions asked

Di_W,你好!

现在还是进不去中断,看起来是TX发送不成功,附件是我的代码,请帮忙看一下,万分感谢!

0 Likes