馬建輝 胡代榮 郭坤
摘 要: 提出并驗證了一種汽車CAN總線網關的報文接收和發送方法。以軟件緩沖區配合CAN控制器的硬件緩沖區,設計軟件緩沖區管理任務,通過與硬件緩沖區的聯動能夠實時地接收報文,保證報文不丟失。同時,在CAN控制器硬件緩沖區未滿時及時將報文發送到總線上,不漏發報文,也不影響周期報文的周期準確性。
關鍵詞: BCM; 低功耗; RKE; CAN總線; 網關; 報文
中圖分類號: TN915.05?34 文獻標識碼: A 文章編號: 1004?373X(2018)11?0005?03
A messages receiving and transmitting method of automotive CAN bus gateway
MA Jianhui1, 2, 3, HU Dairong1, 2, 3, GUO Kun1, 2, 3
(1. Qilu University of Technology (Shandong Academy of Sciences), Jinan 250353, China;
2. Institute of Automation, Shandong Academy of Sciences, Jinan 250014, China;
3. Shandong Key Laboratory of Automotive Electronics Technology, Jinan 250014, China)
Abstract: A massage receiving and transmitting method of automotive CAN bus gateway is proposed and verified. The management tasks of the software buffer were designed to make the software buffer match up the hardware buffer of the CAN controller. The interaction of software buffer with the hardware buffer can realize the real?time message receiving, and ensure the message not to be lost. At the same time, the message is timely sent to the bus before the hardware buffer of CAN controller is completely filled up, which can send all the messages without missing, and maintain the periodic accuracy of periodic messages.
Keywords: BCM; low?power consumption; BKE; CAN bus; gateway; massage
隨著汽車電子部件的增多和智能化程度的提高,CAN總線系統已經成為汽車的重要組成部分。根據功能劃分、拓撲結構設計和實時性的不同要求,汽車一般會設計多個CAN網絡。CAN網絡之間的信息交互由網關實現,網關包括多個CAN接口,接入不同的CAN網絡,實現報文的接收和轉發[1]。在所有的CAN網絡節點中,從報文接收和發送的角度看,網關的負荷是最高的。CAN網絡采用非破壞性仲裁方式競爭總線,任一節點可以在任意時刻向總線發送數據,連接多個CAN網絡的網關可能會在較短的時間內接收到大量報文,并需要在短時間內轉發大量需要路由的報文。進行周期報文的轉發時,根據不同汽車廠家的要求,報文周期一般需要保證在規定值的±10%以內,這對網關的實時性、準確性都提出了較高的要求。
出于成本節約和集成化的要求,汽車電子零部件采用MCU內部的CAN控制器結合物理層芯片實現CAN總線通信[2]。由于低成本MCU的內部CAN控制器的硬件接收緩沖區和硬件發送緩沖區很小,當CAN網絡上短時間內出現大量報文時,如果未能及時讀取硬件接收緩沖區中的數據并清零標志位,便無法接收新的報文;……