公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

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

cross mob
Translation_Bot
Community Manager
Community Manager
Community Manager

"Chasis_CAN 代码" 运行良好,但"EPB_AM_CAN 代码" 运行不良。
“ KIT_A2G_TC387_MOTORCTR ”示例代码中是否有任何部分需要针对 3 个以上 CAN 传输进行修改?

 

 

 

 

 

void McmCan_Init(void)

{

 

#if1

/* ==========================================================================================

* CAN01 模块配置和初始化:

* ==========================================================================================

* 将 CAN 模块默认配置加载到配置结构中

* 用默认配置初始化 CAN 模块

* ==========================================================================================

*/

 

IfxCan_Can_initModuleConfig(&g_mcmcan[Chasis_CAN]。canConfig,&module_can0);

 

IfxCan_Can_initModule(&g_mcmcan[Chasis_CAN].canModule,&g_mcmcan[Chasis_CAN].canConfig);

 

/* 通用设置 */

IfxCan_Can_initNodeConfig(&g_mcmcan[Chasis_CAN].canNodeConfig,&g_mcmcan[Chasis_CAN].canModule); // CAN 设置(IfxCan_Can.c)

 

g_mcmcan[Chasis_CAN].canNodeConfig.引脚=&Can01_pins;

g_mcmcan[Chasis_CAN].canNodeConfig.busLoopbackEnabled= FALSE;

g_mcmcan[Chasis_CAN].canNodeConfig.nodeId= ifxCan_NodeId_1;

 

/* ==========================================================================================

* 源 CAN 节点配置和初始化:

* ==========================================================================================

* 将默认 CAN 节点配置加载到配置结构中

*

* 将 CAN 源节点分配给 CAN 节点 0

*

* - 将帧定义为传输帧

*

* 传输完成后,启动中断

* 定义传输完成中断优先级

* - 将中断线 0 指定给传输完成中断

* 传输完成中断服务例程应由 CPU0 提供服务

*

* 用修改后的配置初始化 CAN 源节点

* ==========================================================================================

*/

/* Tx 配置*/

 

 

g_mcmcan[Chasis_CAN].canNodeConfig..类型= IfxCan_FrameType_transmit;

 

 

g_mcmcan[Chasis_CAN].canNodeConfig.中断配置.传输已完成= TRUE;

g_mcmcan[Chasis_CAN].canNodeConfig.中断配置.traco.中断配置= isr_priority_can01_tx;

g_mcmcan[Chasis_CAN].canNodeConfig.中断配置.traco.中断行= IfxCan_InterruptLine_2;

g_mcmcan[Chasis_CAN].canNodeConfig.中断配置.traco.服务类型= IfxSrc_Tos_cpu0;

g_mcmcan[Chasis_CAN].canNodeConfig.消息 RAM.txBuffersStartAddress= 0x100;

// g_mcmcan[Chasis_CAN].canNodeConfig.messageRAM.baseAddress = (uint32)&MODULE_CAN0;

 

IfxCan_Can_initNode(&g_mcmcan[Chasis_CAN].canSrcNode,&g_mcmcan[Chasis_CAN].canNodeConfig);

 

/* 使用默认配置初始化 RX 报文 */

IfxCan_Can_initMessage(&g_mcmcan[Chasis_CAN]。txMsg);

 

 

/* Rx 配置*/

 

g_mcmcan[Chasis_CAN].canNodeConfig..类型= IfxCan_FrameType_receive;

 

g_mcmcan[Chasis_CAN].canNodeConfig.中断配置.messageStoredToDedicatedRxBufferEnabled= TRUE;

g_mcmcan[Chasis_CAN].canNodeConfig.中断配置.reint.中断配置= isr_priority_can01_rx;

g_mcmcan[Chasis_CAN].canNodeConfig.中断配置.reint.中断行= IfxCan_InterruptLine_3;

g_mcmcan[Chasis_CAN].canNodeConfig.中断配置.reint.服务类型= IfxSrc_Tos_cpu0;

// g_mcmcan[Chasis_CAN].canNodeConfig.messageRAM.standardFilterListStartAddress。 = 0x1A0;

// g_mcmcan[Chasis_CAN].canNodeConfig.messageRAM.rxBuffersStartAddress = 0x200;

 

IfxCan_Can_initNode(&g_mcmcan[Chasis_CAN]。canDstNode,&g_mcmcan[Chasis_CAN].canNodeConfig);

 

/* 使用默认配置初始化 RX 报文 */

IfxCan_Can_initMessage(&g_mcmcan[Chasis_CAN]。rxMsg);

 

#endif

 

/* ==========================================================================================

* CAN 过滤器配置和初始化:

* ==========================================================================================

* - 过滤器配置存储在过滤器元件编号 0 下

* 将接收到的帧存储在专用的 RX 缓冲器中

* 定义与 TX 报文相同的报文 ID

* 将滤波器分配给专用的 RX 缓冲区(本例中为 RxBuffer0)

*

* 用修改后的配置初始化标准过滤器

* ==========================================================================================

*/

#if0

/* ID : 0x81 */

g_mcmcan.canFilter.number = 0;

g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;

g_mcmcan.canFilter.type = IfxCan_FilterType_classic;

g_mcmcan.canFilter.id1 = 0x81;

g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_0;

ifxcan_can_setStandardFilter(g_mcmcan.candstNode,g_mcmcan.canfilter);&&

 

/* ID : 0x113 */

g_mcmcan.canFilter.number = 1;

g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;

g_mcmcan.canFilter.type = IfxCan_FilterType_classic;

g_mcmcan.canFilter.id1 = 0x113;

g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_1;

ifxcan_can_setStandardFilter(g_mcmcan.candstNode,g_mcmcan.canfilter);&&

 

/* ID : 0x512 */

g_mcmcan.canFilter.number = 2;

g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;

g_mcmcan.canFilter.type = IfxCan_FilterType_classic;

g_mcmcan.canFilter.id1 = 0x512;

g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_2;

ifxcan_can_setStandardFilter(g_mcmcan.candstNode,g_mcmcan.canfilter);&&

 

#endif

 

 

#if0

/* ==========================================================================================

* EPB CAN 模块配置和初始化:

* ==========================================================================================

* 将 CAN 模块默认配置加载到配置结构中

* 用默认配置初始化 CAN 模块

* ==========================================================================================

*/

 

IfxCan_Can_initModuleConfig(&g_mcmcan[EPB_AM_CAN].canConfig,&MODULE_CAN1);

 

IfxCan_Can_initModule(&g_mcmcan[EPB_AM_CAN].canModule,&g_mcmcan[EPB_AM_CAN].canConfig);

 

/* 通用设置 */

IfxCan_Can_initNodeConfig(&g_mcmcan[EPB_AM_CAN].canNodeConfig,&g_mcmcan[EPB_AM_CAN].canModule); // CAN 设置(IfxCan_Can.c)

 

g_mcmcan[EPB_AM_CAN].canNodeConfig.pins =&Can11_pins;

 

g_mcmcan[EPB_AM_CAN].canNodeConfig.busLoopbackEnabled = FALSE;

g_mcmcan[EPB_AM_CAN].canNodeConfig.nodeId = IfxCan_NodeId_1;

 

/* ==========================================================================================

* 目的地 CAN 节点配置和初始化:

* ==========================================================================================

* 将默认 CAN 节点配置加载到配置结构中

*

* 将目的地 CAN 节点分配给 CAN 节点 0

*

* - 将帧定义为接收帧

*

* 一旦信息存储在专用的 RX 缓冲区中,就引发中断

* 定义接收中断优先级

* - 将中断线 1 指定为接收中断

* - 接收中断服务例程应由 CPU0 服务

*

* 用修改后的配置初始化目标 CAN 节点

* ==========================================================================================

*/

/* Rx 配置*/

g_mcmcan[EPB_AM_CAN].canNodeConfig.frame.type = IfxCan_FrameType_receive;

 

g_mcmcan[EPB_AM_CAN].canNodeConfig.interruptConfig.messageStoredToDedicatedRxBufferEnabled = TRUE;

g_mcmcan[EPB_AM_CAN].canNodeConfig.interruptConfig.reint.priority = ISR_PRIORITY_CAN11_RX;

g_mcmcan[EPB_AM_CAN].canNodeConfig.interruptConfig.reint.interruptLine = IfxCan_InterruptLine_4;

g_mcmcan[EPB_AM_CAN].canNodeConfig.interruptConfig.reint.typeOfService = IfxSrc_Tos_cpu1;

g_mcmcan[EPB_AM_CAN].canNodeConfig.messageRAM.standardFilterListStartAddress = 0x300;

g_mcmcan[EPB_AM_CAN].canNodeConfig.messageRAM.rxBuffersStartAddress = 0x3A0;

 

 

 

IfxCan_Can_initNode(&g_mcmcan[EPB_AM_CAN].canDstNode,&g_mcmcan[EPB_AM_CAN].canNodeConfig);

 

/* 使用默认配置初始化 RX 报文 */

IfxCan_Can_initMessage(&g_mcmcan[EPB_AM_CAN].rxMsg);

 

 

/* ==========================================================================================

* 源 CAN 节点配置和初始化:

* ==========================================================================================

* 将默认 CAN 节点配置加载到配置结构中

*

* 将 CAN 源节点分配给 CAN 节点 0

*

* - 将帧定义为传输帧

*

* 传输完成后,启动中断

* 定义传输完成中断优先级

* - 将中断线 0 指定给传输完成中断

* 传输完成中断服务例程应由 CPU0 提供服务

*

* 用修改后的配置初始化 CAN 源节点

* ==========================================================================================

*/

/* Tx 配置*/

g_mcmcan[EPB_AM_CAN].canNodeConfig.frame.type = IfxCan_FrameType_transmit;

 

g_mcmcan[EPB_AM_CAN].canNodeConfig.interruptConfig.transmissionCompletedEnabled = TRUE;

g_mcmcan[EPB_AM_CAN].canNodeConfig.interruptConfig.traco.priority = ISR_PRIORITY_CAN11_TX;

g_mcmcan[EPB_AM_CAN].canNodeConfig.interruptConfig.traco.interruptLine = IfxCan_InterruptLine_3;

g_mcmcan[EPB_AM_CAN].canNodeConfig.interruptConfig.traco.typeOfService = IfxSrc_Tos_cpu0;

g_mcmcan[EPB_AM_CAN].canNodeConfig.messageRAM.txBuffersStartAddress = 0x200;

g_mcmcan[EPB_AM_CAN].canNodeConfig.txConfig.dedicatedTxBuffersNumber = 2;

g_mcmcan[EPB_AM_CAN].canNodeConfig.messageRAM.txBuffersStartAddress = 0x400;

g_mcmcan[EPB_AM_CAN].canNodeConfig.messageRAM.baseAddress = (uint32)&MODULE_CAN1;

 

IfxCan_Can_initNode(&g_mcmcan[EPB_AM_CAN].canSrcNode,&g_mcmcan[EPB_AM_CAN].canNodeConfig);

 

/* 使用默认配置初始化 TX 报文 */

IfxCan_Can_initMessage(&g_mcmcan[EPB_AM_CAN].txMsg);

 

#endif

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/Inquire-CAN-Node0-node1-node2-port-extension-using-example-code/td-p/692034

0 点赞
3 回复数
Translation_Bot
Community Manager
Community Manager
Community Manager

你好@WIT_CHO

"Chasis_CAN 代码" 运行正常,但"EPB_AM_CAN 代码" 运行不正常。
,您的意思是没有输出信号?如果是这样的话、
您还能分享"Can11_pins" 的配置吗?


谨致
Ulises

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/Inquire-CAN-Node0-node1-node2-port-extension-using-example-code/m-p/693227

0 点赞
Translation_Bot
Community Manager
Community Manager
Community Manager

你好 Ulises_L

 

#if 1
/* CAN01 C_CAN */
IFX_CONST IfxCan_Can_Pins Can01_pins = {
&IfxCan_TXD01_P14_0_OUT, IfxPort_Mode_outputPushPullAlt5,
&IfxCan_RXD01B_P14_1_IN, IfxPort_Mode_inputPullUp,
IfxPort_PadDriver_cmosAutomotiveSpeed2
};
#endif
#if 1
/* CAN11 EPB_AM_CAN */
IFX_CONST IfxCan_Can_Pins Can11_pins = {
&IfxCan_TXD11_P23_6_OUT, IfxPort_Mode_outputPushPullAlt5,
&IfxCan_RXD11C_P23_7_IN, IfxPort_Mode_inputPullUp,
IfxPort_PadDriver_cmosAutomotiveSpeed2
};
#endif

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/Inquire-CAN-Node0-node1-node2-port-extension-using-example-code/m-p/693295

0 点赞
Translation_Bot
Community Manager
Community Manager
Community Manager

你好@WIT_CHO

对于延迟回复,我深表歉意。

CAN 连接的引脚选择是正确的。我看到的一点是,您代码中的灰色部分似乎没有激活以下命令"#if 0" 和"#endif" ,您是否在测试程序时将其改为"#if 1" 以激活它们?

最美好的祝愿,
Ulises

 

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/Inquire-CAN-Node0-node1-node2-port-extension-using-example-code/m-p/697925

0 点赞