公告

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

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

cross mob
想要飞翔的鱼
Level 1
目前是在死循环中查询,想要配置成中断接收
0 点赞
21 回复数
hou
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted
我用的是TC27x应该差不多,在配置报文时使能中断,配置好srcid,再将这个srcid与提供中断服务的CPU和中断优先级绑定,最后定义好中断就可以了。
0 点赞
想要飞翔的鱼
Level 1
怎么配置中断服务子程序isr IFX_INTERRUPT(Ifx_Can_Rx,0,15); void Ifx_Can_Rx(void)是接收函数,这个函数在主函数里面运行没问题
0 点赞
hou
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted
Ifx_Can_Rx(void)是中断啊,isr IFX_INTERRUPT(Ifx_Can_Rx,0,15)声明了它,接受到对应ID的报文就会跳转到中断中啊
0 点赞
想要飞翔的鱼
Level 1
我在中断服务子程序中SRC_CANINT15.B.CLRR = 1;清除了中断,程序接收到规定的ID还是跑飞了,是我的清中断方式不对吗?canMsgObjConfig.rxInterrupt.enabled = 1; canMsgObjConfig.rxInterrupt.srcId = IfxMultican_SrcId_15;
0 点赞
郝_
Level 4
Level 4
100 replies posted 50 replies posted 25 replies posted
中断向量号没配
0 点赞
想要飞翔的鱼
Level 1
IFX_INTERRUPT(Ifx_Can_Rx,0,15); void SetCanInterrupt(void) { SRC_CAN_CAN0_INT0.B.SRPN = 15; SRC_CAN_CAN0_INT0.B.CLRR = 1; SRC_CAN_CAN0_INT0.B.TOS = 0; SRC_CAN_CAN0_INT0.B.SRE = 1; SRC_CAN_CAN0_INT0.B.SRR = 1; } canMsgObjConfig.rxInterrupt.enabled = 1; canMsgObjConfig.rxInterrupt.srcId = 15; canMsgObjConfig.priority = 2; src = IfxMultican_getSrcPointer(&MODULE_CAN,15); IfxSrc_init(src,0,15); IfxSrc_enable(src); 这些我都做了。。。。
0 点赞
hou
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted
src我这里是个指针变量
0 点赞
想要飞翔的鱼
Level 1
我这个也是啊,不是的话,编译也过不去。
0 点赞
hou
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted
src = IfxMultican_getSrcPointer(&MODULE_CAN,15); 我的意思是*src = IfxMultican_getSrcPointer(&MODULE_CAN,15);
0 点赞
想要飞翔的鱼
Level 1
volatile Ifx_SRC_SRCR *src; 我在前面定义了啊。。大哥,是src = IfxMultican_getSrcPointer(&MODULE_CAN,IfxMultican_SrcId_15); 不是volatile Ifx_SRC_SRCR *src = IfxMultican_getSrcPointer(&MODULE_CAN,IfxMultican_SrcId_15);。。。。我c语言基础还是可以的
0 点赞
想要飞翔的鱼
Level 1
而且之前发送也是可以的,自从我把node的transfer中断打开后,发送也会进入中断,我觉得是清除中断标志位错了,不知道怎么清除,忘不吝赐教。
0 点赞
想要飞翔的鱼
Level 1
SRC_CANINT15.B.CLRR = 1; 我的清中断方式
0 点赞
hou
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted
这个不太清楚,我的不清也能用的
0 点赞
想要飞翔的鱼
Level 1
老哥,你们加个球球联系一下吗?我纠结好多天了我2 4 3 8 6 0 2 3 5 0 谢谢啦
0 点赞
我的是TC234的,不过应该差不多。 首先是初始化。先是初始化CAN节点 IfxMultican_Can_Node_initConfig(&Config, &g_MulticanBasic.drivers.can); Config.baudrate = 1000000; Config.loopBackMode = FALSE; Config.nodeId = (IfxMultican_NodeId)((int)IfxMultican_NodeId_0); Config.rxPin = &IfxMultican_RXD0B_P20_7_IN; Config.rxPinMode = IfxPort_InputMode_pullUp; Config.txPin = &IfxMultican_TXD0_P20_8_OUT; Config.txPinMode = IfxPort_OutputMode_pushPull; IfxMultican_Can_Node_init(&g_MulticanBasic.drivers.SrcNode.canNode, &Config); 然后是初始化CAN节点的接受对象 IfxMultican_Can_MsgObj_initConfig(&canMsgTranObjConfig, &g_MulticanBasic.drivers.SrcNode.canNode); canMsgTranObjConfig.msgObjId = 3; canMsgTranObjConfig.messageId = Mutican_slave_id; canMsgTranObjConfig.acceptanceMask = 0x7FFFFFFfUL; canMsgTranObjConfig.frame = IfxMultican_Frame_receive; canMsgTranObjConfig.control.messageLen = IfxMultican_DataLengthCode_8; canMsgTranObjConfig.control.extendedFrame = FALSE; canMsgTranObjConfig.control.matchingId = TRUE; canMsgTranObjConfig.rxInterrupt.enabled= TRUE; canMsgTranObjConfig.rxInterrupt.srcId=IfxMultican_SrcId_2; IfxMultican_Can_MsgObj_init(&g_MulticanBasic.drivers.SrcNode.canRecMsgObj, &canMsgTranObjConfig);
0 点赞
初始化完节点和对象以后是初始化中断向量 src = IfxMultican_getSrcPointer(&MODULE_CAN,IfxMultican_SrcId_2); IfxSrc_init(src, ISR_PROVIDER_MultiCAN_2, ISR_PRIORITY_MultiCAN_2); IfxSrc_enable(src); IfxMultican_Message_init(&msg1, Mutican_slave_id, 0, 0, IfxMultican_DataLengthCode_8); 中断是这样子的: IFX_INTERRUPT(ISR_MultiCANLine2, 0, ISR_PRIORITY_MultiCAN_2); void ISR_MultiCANLine2(void) { Ifx_CAN_MO *hwObj = IfxMultican_MsgObj_getPointer(&MODULE_CAN, g_MulticanBasic.drivers.SrcNode.canRecMsgObj.msgObjId); if(IfxMultican_MsgObj_isRxPending(hwObj)) { MulticanRecieve(); IfxMultican_MsgObj_clearRxPending(hwObj); } } void MulticanRecieve(void) { IfxMultican_Can_MsgObj_readMessage(&g_MulticanBasic.drivers.SrcNode.canRecMsgObj, &msg1); RevieveData.dataH.U=msg1.data[1]; RevieveData.dataL.U=msg1.data[0]; } 差不多就这样,你应该可以中断接收到id=Mutican_slave_id的CAN信息了,中断优先级自己去随意定义
0 点赞
想要飞翔的鱼
Level 1
现在一发送设定的ID,就会跑飞,是进入中断了,但我在isr里面清中断了,也跑飞SRC_CAN_CAN0_INT15.B.CLRR = 1; 不知道如何清除中断
0 点赞
ZERO_GO
Level 6
Level 6
5 sign-ins Welcome!
学习一下
0 点赞
阳东
Level 5
Level 5
10 comments on blog 5 comments on blog First comment on blog
没用过。。
0 点赞
liliWinner
Level 6
Level 6
500 replies posted 250 replies posted 100 replies posted
最后是中断向量号没有配置的原因吗
0 点赞
User22064
Level 5
Level 5
10 sign-ins First like given 5 sign-ins
关注一下
0 点赞