FlexCAN初始化注意事项
-
SDK中FlexCAN初始化注意事项:
如果采用中断方式收发,注册回调函数FLEXCAN_DRV_InstallEventCallback和FLEXCAN_DRV_InstallErrorCallback,以及mailbox或fifo,滤波器的初始化需要放在启动接收函数之前
例如,以下为不太合理的邮箱初始化程序:/* Config rx messages mailbox */ for (index = 0; index < Appl_Can_NodeRxMsgCount[canNodeIndex]; index++) { /* Config rx buffer */ status = CAN_ConfigRxBuff(&can_pal_instance, index, &Appl_Can_StdIdBuffCfg, (uint32_t)Appl_Can_NodeRxMsgPtr[canNodeIndex][index].id); /* start to receive message */ status = CAN_Receive(&can_pal_instance, index, (can_message_t *)&Appl_Can_NodeRxMsgPtr[canNodeIndex][index]); }
应更改为:
/* Config rx messages mailbox */ for (index = 0; index < Appl_Can_NodeRxMsgCount[canNodeIndex]; index++) { /* Config rx buffer */ status = CAN_ConfigRxBuff(&can_pal_instance, index, &Appl_Can_StdIdBuffCfg, (uint32_t)Appl_Can_NodeRxMsgPtr[canNodeIndex][index].id); } for (index = 0; index < Appl_Can_NodeRxMsgCount[canNodeIndex]; index++) { /* start to receive message */ status = CAN_Receive(&can_pal_instance, index, (can_message_t *)&Appl_Can_NodeRxMsgPtr[canNodeIndex][index]); }
-
楼主有CAN中断接收的demo吗?
-
此回复已被删除!
-
帮助没办法联网的电脑使用YCT
帮助改进和优化YT CONFIG TOOL,有机会抽取YTM32B1ME0 EVB哦...