--- Restore content start ---
CAN bus features:
1. Multi-Master Control
When the bus is idle, all units can start to send messages (Multi-master control );
The unit that first accesses the bus gets the sending permission (identify mode: "CSMA/CA mode ");
When multiple units start sending at the same time, the units that send messages with high-priority IDS can obtain the sending permission;
2. Message sending
In the CAN protocol, all messages are
CAN bus protocol Overview:
Can is short for Controller Area Network, developed by Bosch, Germany. Can is standardized through iso11891 and iso11519;
It is sent in a fixed format. When the bus is idle, all units connected to the bus can start to send new messages. When two or more units start sending messages at the same time, the priority is determined based on the identifier (ID. The ID does not indicate the destination address of the message to be sent, but the priority of the message to access the bus. When two or more units start to send messages at the same time, each bit of each Message ID is arbitrated one by one, and the unit that wins the arbitration (highest priority) continues to send messages, units that fail the arbitration will immediately stop sending and receive messages;
3. system flexibility
The unit connected to the bus does not have information similar to the "Address". Therefore, when a unit is added to the bus, the hardware and software of other units connected to the bus and the application layer do not need to be changed;
4. communication speed
You can set a suitable communication speed based on the size of the entire network. Up to 1 Mbps;
In the same network, all units must be set to a unified communication speed. Even if the communication speed of one unit is different from that of other units, this unit will output an error signal, hindering the communication of the entire network, different networks can have different communication speeds;
5. Remote data requests
Remote frames can be sent to other units to send data;
6. Error Detection (Error Notification and error recovery)
All units can detect errors (error detection function)
The unit that detects the error will immediately notify all other units (the Error Notification function)
Once an error is detected for a unit in which a message is being sent, the current message is forcibly sent. Units that force end sending will repeatedly resend the message until the message is sent successfully (error recovery function );
7. Fault Closure
Can can determine whether the error type is temporary data errors on the bus (such as external noise) or continuous data errors (such as internal unit faults or drive errors ). When a continuous error is sent on the bus, the faulty unit may be isolated from the bus;
8. Connection
CAN bus is a bus that can be connected to multiple units at the same time. Theoretically, there is no limit on the total number of connectable units. However, the number of actually connectable units is limited by the time delay and electrical load on the bus. Reduces the communication speed, increases the number of connectable units, and increases the communication speed;
CAN bus protocol:
The CAN Bus covers the transport layer, data link layer, and physical layer defined by OSI;
Physical Layer:
It determines the bit encoding method (NRZ encoding, 6-Bit Insert filling bits), bit sequence (bit timing, bit sampling), and synchronization mode (Synchronization Based on the synchronization segment SS, but specifically, the electrical characteristics of the signal level, communication speed, sampling points, drivers and bus, and the form of connectors are not defined,The user shall determine it by himself;
Transport Layer:
Defines the re-sending control;
Data link layer:
The data link layer is divided into two child layers: LLC (Logical Link Control) and MAC (Media Access Control;
The sublayer of the LLC executes the selection of received messages (point-to-point, broadcast, multicast), overload notification (notification receipt preparation is still complete), and error recovery function (resend );
MAC layer: data frame (four frame types), connection mode control (competitive mode), message arbitration (ID arbitration), and fault diffusion suppression (automatic identification of temporary errors and continuous errors, troubleshooting node), Error Notification (CRC error, filling location error, bit error, Ack error, format error), error detection, response method (ACK, NACK ), communication Mode (Half Duplex) and other settings;
The MAC Sub-layer is the core of the CAN protocol. The function of the data link layer is to form meaningful messages from the physical layer and provide transmission control procedures such as error control. The function of the data link layer is usually executed in the hardware of the CAN controller;
Frame concept:
Data frame: the frame used by the sending unit to receive the data transmitted by the Unit;
Remote Control Frame (request frame): used to receive frames that send data from units with the same ID;
Error frame: the frame used to notify other units of an error when an error is detected;
Overload frame: used to receive frames that are not ready for receiving by the receiving unit;
Frame interval: used to separate the data frame and remote control frame from the previous frame.
Both the data frame and remote control frame have two formats: Standard Format and extended format. The standard format has 11 identifier (later called ID), and the extended format has 29 IDs;
--- Restore content end ---
Watchdog for stm32