Function Overview:
Bxcan is short for basic extended can. It supports the can protocols 2.0a and 2.0b. It is designed to efficiently process a large number of packets with minimal CPU load. It also supports priority requirements for message sending (priority can be configured by software ).
CAN2.0B kernel:
The bxcan module can automatically receive and send can packets, and fully supports standard Identifiers (11 bits) and extended Identifiers (29 BITs ).
Main features:
Supports the active mode of the CAN protocol 2.0a and 2.0b;
The baud rate can reach up to 1 Gb/s/second (belongs to the osi11898 standard)
Supports time-triggered communication. (data can be synchronized through timestamps)
Send
3 sending mailboxes (Email: Includes, Data, address, ID, etc)
A total of three email addresses are used by the software to send messages. The sender scheduler determines which mailbox message is sent first based on the priority;
The priority of sent packets can be configured by software.
Record the time stamp of the time when the sof is sent
Receive
Level 3 depth of two receiving FIFO;
There are two receiving FIFO queues, each of which can store three complete packets. They are completely managed by hardware;
14-bit wide Variable Filter groups-shared by the entire can; (messages that do not pass the filter are directly discarded)
There are a total of 14 bit wide variable/configurable identifier filter groups. By setting them, the software selects the required packets in the packets received by the pin, and discards other packets.
Identifier list;
The FIFO overflow processing method can be configured;
Record the timestamp of the time when the sof is received;
Supports time-triggered Communication Mode
Disable automatic retransmission Mode
16-bit self-running timer; (timer function: Provides timestamp)
Configurable timer resolution
The timestamp can be sent in the last two data bytes.
Management
Interruption shielding
Email occupies one separate address space to improve software Efficiency
Related registers:
Control, status, and configuration register
Through these registers, the application can:
Configure the can parameter, such as the speed-related baud rate (the so-called baud rate is the time it takes to send a single bit of data)
Send Request Message
Handle message reception
Management interruption
Obtain diagnostic information
CAN bus framework: bxcan working mode:
Bxcan has three main working modes: initialization, normal, and sleep;
It also includes test mode, silent mode, loop-back mode, and loop-back silent mode.
Initialization mode: This mode is mainly used for configuration. After the configuration is complete, it enters the normal mode. Then enter the sleep mode (low-power mode)
Packet sending process:
Message receiving process:
The received packets are stored in the FIFO in the depth of the 3-level mailbox. FIFO is fully managed by hardware, which saves the CPU processing load, simplifies the software, and ensures data consistency. The application can only read the first packet received in the FIFO by reading the output mailbox of the FIFO;
Valid message
According to the CAN protocol, when the message is correctly received (until the last bit of the EOF domain is correct), and the identifier is passed
The message is considered as a valid message. See 14.5.4: Identify filtering.
Receive related interruptions
Once one packet is saved to the FIFO, the hardware will update the FMP [1:0] bit, and if the fmpie bit of the can_ier register
If the value is 1, an interrupt request is generated.
When the FIFO is full (that is, 3rd packets are saved), the full bit of the can_rfxr register is set to 1. If
If the ffie bit of the can_ier register is 1, a full interrupt request is generated.
In case of overflow, The fovr bit is set to 1, and if the fovie bit of the can_ier register is 1
An overflow interrupt request.
CAN bus inside stm32