返回列表 回復 發帖

[教學] What is CAN Bus?

 ,  描述: 成日聽到CAN Bus,到底他是甚麼?
                        The CAN Bus is an automotivebus developed by Robert Bosch, which has quickly gained acceptance intothe automotive and aerospace industries. CAN is a serial bus protocolto connect individual systems and sensors as an alternative toconventional multi-wire looms. It allows automotive components tocommunicate on a single or dual-wire networked data bus up to 1Mbps.
                       
                                                                        Before CAN Bus                       
                                Sincethe early 1940's, automakers have continually improved their vehicles'technology by integrating an increasing amount of electroniccomponents. As technology progressed, the vehicles became more complexas electronic components replaced mechanical systems and providedadditional comforts, convenience, and safety features. Up until therelease of CAN Bus, vehicles contained enormous amounts of wiring whichwas necessary to interconnect all of the various electronic components.
                       

                                       

                       
                        Dueto the vast amount of wiring, an after market installation requires theinstaller not only to understand how the integrated systems communicatewith each other, but also requires numerous connections to be madethroughout the vehicle. To make matters worse, the vehicle wiringdiffers between vehicle years, makes, and even models. As a result,installers need to be highly knowledgeable and perform intensive laborfor the most trivial after market equipment or the installation shopexperiences countless hours of lost time on troubleshooting andsometimes even expensive claims for damaged OEM equipment. During thisprogression, installation shops have had an increasingly difficult timefinding qualified staff that are able to perform everyday installationsand as a result, have either had to increase their prices to compensatefor the required specialization and labor, or simply had to turn awaythe customers who owned complex vehicles.
                       

                                               

                        Introducing CAN Bus                       
                                TheBMW 850 coupe was the first CAN Bus vehicle to enter the market in1986. By reducing the vehicles wiring by 2km, the vehicles overallweight was significantly reduced by at least 50kg and using only halfthe connectors. For the first time, each of the vehicles systems andsensors were able to communicate at very high speeds (25kbps - 1Mbps)on a single or dual-wire communication line as opposed to the previousmulti-wire looms. However, the introduction of CAN Bus also increasedthe vehicles complexity and made after market installations even moredifficult and in many cases impossible to perform.
                       

                                               

                       
                                In2006, over 70% of all automobiles sold in North America will utilizeCAN Bus technology. Beginning in 2008, the Society of AutomotiveEngineers (SAE) requires 100% of the vehicles sold in the USA to usethe CAN Bus communication protocol while the European Union has similarlaws. Several new after market devices have been introduced into themarket that utilize the CAN Bus protocol but until now, there have beenno new devices that assist the aging after market remote starter andalarm system technology. Now there is an after market module thatoffers remote starter and alarm connectivity to the CAN Buscommunication protocol.
                       
受教了,谢谢
以下是轉載自維基百科

控制器區域網路 (Controller Area Network, 簡稱 CAN 或 CANbus) 是一種通訊協定,其特點是允許網路上的設備直接互相通訊,網路上不需要主機 (Host)控制通訊。

簡介

CAN是在1990年代初所制定的規格,並在1993年標準化(ISO 11898-1),被廣泛的應用在各種車輛與電子設備上。CAN為一序列匯流排,它提供高安全等級及有效率的即時控制。更具備了偵錯和優先權判別的機制,在這樣的機制下,網路訊息的傳輸變的更為可靠而有效率。CAN 亦提供多主控端的架構,這種特色,特別適合使用在主系統或子系統下提供更完整智慧型網路設備,如感測器及致動器。

CAN是建立在基於資訊導向傳輸協定的廣播傳輸機制(broadcast communication mechanism)上。CAN定義資訊的內容,利用訊息識別子(message identifier,每個message identifier在整個網路中皆為獨一無二的)來定義內容和資訊的優先順位,以進行資訊的傳遞。並非使用指派特定站台位址(station address)的方式。
File:Broadcast(can).png
broadcast

如此,CAN擁有了高度的彈性調整能力,可以在既有的網路中增加站台而不用在軟硬體上作修正與調整的作業。除此之外,資訊的傳遞不是建構在特殊種類的站台上,增加了在升級網路時的便利性。

即時的資訊傳輸(Real-time data transmission)為CAN的特色之一。在即時的運算中,訊息傳遞的優先順序應以重要性來分,重要性較高的訊息會比較不重要的訊息傳遞的更頻繁。
[编辑] 仲裁機制

訊息的優先權是由訊息封包的message identifier所決定的,identifier的屬性則是由系統一開始所給定的二進位數值決定,其數值是不能一直改變的。數值越小,就享有越高的優先順位。

即時環境中使用的通訊協定優點:

    * 訊息有分優先次序
    * 有限度的訊息傳遞延遲
    * 訊息可多重發送、資料確保一致性
    * 可分辨資料是網路傳送錯誤或是裝置不正常運作所造成,進而將有問題的網路節點關閉

仲裁機制 1

CAN base frame一開始是SOF(Start Of Frame),接著是仲裁區Arbitration field(包含identifier和遠端傳輸要求RTR(Remote Transmission Request)),之後的IDE(Identifier Extension)用來分辨是base frame或extended frame。DLC(Data Length Code)記錄了data field的大小。

當兩種格式同時存在於同一個匯流排時,11-bit的訊息將會擁有比29-bit的訊息較高的優先順位。可支援extended frame的CAN controller可正確的傳送base frame與extended frame的訊息,但是只支援base frame的controller則無法正確的傳送extended frame的訊息。
[编辑] 偵錯機制

CAN 提供了五種偵錯機制,使其錯誤發生率低於 4.7×10-11。當一個以上的上述錯誤發生時,傳送中的傳輸將會失敗中止並且產生錯誤封包,發訊端則會試著重新傳送訊息封包。各個節點將會重新爭取優先權。

CAN的五種偵測錯誤機制
循环冗余校验 (CRC)     CRC在訊息結尾處加上一個FCS(frame check sequence)來確保訊息的正確。接收訊息端會將其FCS重新演算並與所接收到的FCS比對,如果不相符,表示有CRC錯誤。
Frame check     檢查封包中幾個固定值的欄位以驗證該封包是否有被訊號干擾導致內容錯誤。
ACK errors     接收端在收到封包後會告知發訊端,發訊端若沒有收到確認訊息,ACK錯誤便發生。
Monitoring     傳一個bit到網路上,從網路上再讀進來檢查是否一致。
Bit stuffing     訊號同步用
[编辑] 實體層

實體層以電、光或物理的方式將訊息在網路中傳遞,它提供硬體性質的載體來傳送與接收訊息。

ISO定義了一個標準,整合了CAN的規格與實體層physical layer,包括了編碼Bit Encoding、時間機制Bit Timing和同步Synchronization。

CAN使用NRZ(Non-Return-to-Zero)bit encoding,而其signal level在位元期間內都是保持穩定的。其signal level甚至可以在更長的時段內維持穩定,因此必須確保訊號不會超過最大允許的時段範圍,這對訊號同步而言是很重要的。利用bit stuffing在連續五個等值的bit後面填補一個 bit。接收端在將這個bit給去除(un-stuff)以處理原始資料內容。

Bus須能夠呈現兩種邏輯狀態(dominant & recessive),假如有兩個裝置同時對bus傳輸不同的邏輯狀態的訊息時,只有傳送dominant狀態的裝置能夠成功傳輸資料並繼續其動作。

Bus必須能分辨網路傳輸錯誤或是裝置運作錯誤所產生的錯誤訊息,並且可以將運作錯誤的裝置關閉。
返回列表