# CAN #
author: 陳煥宇
date: 2025/10/6
* 參考資料:
[CAN Bus: Serial Communication - How It Works?](https://www.youtube.com/watch?v=JZSCzRT9TTo)
[CAN Bus Explained - A Simple Intro [v2.0 | 2021] 🌟](https://youtu.be/oYps7vT708E)
[【臺大賽車隊】CAN Bus組教學(連結不宜公開)](https://youtu.be/1L_I03t4S6I)
[RS485 CAN HAT](https://www.waveshare.net/wiki/RS485_CAN_HAT#.E6.A0.91.E8.8E.93.E6.B4.BE.E4.BD.BF.E7.94.A8)
* CAN defintion:
Controller Area Network,像車子的中樞神經系統。
* How it works:
兩條 bus 一高一低,利用傳遞訊號, $V_d$ 大為 1,小為 0,如此可消除 common mode,每個 node 可以決定接不接收。
* benefits:
1. Simple & low cost
2. Fully Centralized
3. Extremely robust: can cancel common mode singals, CRC
4. Efficient: ID with priorities
* properties:
1. Bus Topology
2. Half Duplex
3. Differential
4. Asynchronous
5. Serial Signal
* baud rate & CAN frame
1. 9600 Bd 有效數據訊號調變載波的速率
2. 
(1) ID: Priorities
(2) CRC: Verification code
* decode CAN bus data
1. little endian -> reorder
2. hex -> dec
3. CAN database to convert into physical values
* higher layer protocols
1. J1939
2. OBD2
3. CANopen
* RS485 CAN HAT
1. CAN bus: Check and verify
2. RS485: I/O
3. Important: H-H, L-L