摘要
CAN网络采用广播式通信方式,无效的CAN报文也会消耗CAN节点的计算资源,针对CAN节点需要接收、过滤和解析多个报文的需求,通过设置链接文件的代码段,使得微控制单元(Mcu)在实际运行时,CAN报文接收、滤波和解析函数重定位到RAM中运行,不仅能够加快程序运行速度,降低中断服务程序的运行时间,还可以降低对系统堆栈的要求。同时提出一种报文ID匹配算法,通过设定ID取值子区间,减少了ID比较的次数,提高了报文滤波速度。在CAN报文接收中断服务程序中执行ID快速匹配算法,进行滤波处理后,将有效的报文存人接收缓冲区,降低了接收缓冲区和CAN报文解析任务消息队列的RAM资源需求。同时在进行报文解析时,可以利用在中断服务程序中得到的ID取值子区间,降低ID比较次数,提高了报文解析速度。
CAN network using broadcast communication, invalid CAN message will consume the CAN node computing resources, CAN nodes need to receive, filter and resolve multiple messages, by setting the code segment in the link file, the CAN message reception, filtering and parsing function will be relocated to RAM in the actual operation, which not only speeds up the program running, reduces the running time of the interrupt service routine, but also reduce the requirements for system stacks. At the same time, a message ID matching algorithm is proposed, which reduces the number of ID comparisons by setting the ID sub-interval, improves the packet filtering speed. Implement the ID fast matching algorithm in the CAN message reception interrupt service routine. After filtering, the valid message is stored in the receive buffer, which reduces the RAM resource requirement of the receiving buffer and the CAN message parse task message queue. At the same time, when the message is parsed, it is possible to reduce the number of ID comparisons and improve the resolution of the packets by using the ID sub-range obtained in the interrupt service routine.
作者
马建辉
王知学
侯冬冬
郭坤
Ma Jianhui;Wang Zhixue;Hou Dongdong;Guo Kun(Qilu Universily of Technology (Shandong Academy o{ Sciences) Jinan 250014, China;Automatic Institute of Shandong Academy, Jinan 250014, China;Shan Dong Key Laboratory of Automotive Electronics, Jinan 250014, China)
出处
《电子测量技术》
2018年第3期60-63,共4页
Electronic Measurement Technology
基金
山东省重点研发计划项目(2017GGX10145、2016ZDJS03A04、2016GGC01023)资助