最近學習CAN總結

2021-08-22 14:43:16 字數 1229 閱讀 7593

1,can一次可以傳送少於8個位元組,只是最多可以發8個。

2,   32位遮蔽位模式如何設定過濾器引數?

在32位寬的模式下,can_fxr1與can_fxr2都用來儲存希望通過的canid,由於是32位寬的,因此既可以儲存標準can id,也可以儲存擴充套件can id。

(參考比如設定id的低5位必須與設定的相同,高6位忽略。

標準庫中can_filteridhigh 對應上圖id行的can_fxr1[31:16]

can_filteridlow 對應上圖id行的can_fxr1[15:0]

can_filtermaskidhigh對應上圖id行的can_fxr2[31:16]

can_filtermaskidlow 對應上圖id行的can_fxr2[15:0]

對於標準id(stid)對應的位是高11位,也就是對應id或者mask的can_fxr1[31:21]或can_fxr2[31:21],所以設定can_filteridhigh 或 can_filtermaskidhigh 的值時要左移5位.

can_filteridhigh和can_filteridlow是對應id,定義可以通過的id

can_filtermaskidhigh和can_filtermaskidlow 是設定遮蔽位

比如 id=0x02

遮蔽id=0x1f = 0001 1111,則表示低5位必須與id中定義的低5位值相同,即低5位必須等於2才能通過,其他位忽略。

由於是標準資料幀,所以ide為「0」,rtr為「0」,所以can_filteridlow 和can_filtermaskidlow都=0.

can_filterinitstructure.can_filteridhigh = 0x02 << 5;                     //

can_filterinitstructure.can_filteridlow = 0;                                  //設定過濾器識別符號低位(32為低位段,16位為第二個)

can_filterinitstructure.can_filtermaskidhigh= 0x1f << 5;              //設定過濾器識別符號高位(32為高位段,16位為第乙個)

can_filterinitstructure.can_filtermaskidlow= 0; 

最近學習總結

ubuntu安裝配置mysql sudo apt get install mysql server wget2 解壓縮 tar zxvf mysql connector python 2.1.1.tar.gz3 安裝 cd mysql connector python 2.1.1python set...

最近學習總結

1.雲牆刷流量 使用charles ip埠 擷取手機資料 設定手機 安裝charles證書 2.打ipa包 用itunes裝ipa包 3.定時命令 crontab 檔案中每個條目中各個域的意義和格式 第一列 分鐘 1 59 第二列 小時 1 23 0 表示子夜 第三列 日 1 31 第四列 月 1 ...

CAN匯流排學習資料總結

can 低層或稱硬體 協議僅僅定義了第 1 層 物理層 和第 2 層 資料鏈路層 can匯流排簡明易懂教程 講得不錯 can匯流排簡明易懂教程 一 can匯流排簡明易懂教程 二 can匯流排簡明易懂教程 三 深入淺出 通俗易懂的講解can bus 講解比較通俗易懂 基於stm32的can匯流排通訊學...