The above content is referenced from the Internet. It has been confirmed that the above statement is incorrect for the following reasons:
STM32 has two 3-level deep receive buffers: FIFO0 and FIFO1. Each FIFO can store 3 complete messages, which are completely managed by hardware. If the receive interrupt comes from FIFO0, it is processed by CAN1_RX0_IRQn interrupt. If the receive interrupt comes from FIFO1, it is processed by CAN1_RX1_IRQn interrupt. During the initialization configuration of CAN, use CAN_FilterFIFOAssignment to select the FIFO to use.
Here is an example:
1. Configure the filter
CAN_FilterInitStructure.CAN_FilterNumber = 0;
CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask;
CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit;
CAN_FilterInitStructure.CAN_FilterIdHigh = 0x0000;
CAN_FilterInitStructure.CAN_FilterIdLow = 0x0000;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0x0000;
CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0x0000;
CAN_FilterInitStructure.CAN_FilterFIFOAssignment = 0; //关联FIFO0
CAN_FilterInitStructure.CAN_FilterActivation = ENABLE;
CAN_FilterInit(&CAN_FilterInitStructure);
CAN_FilterInitStructure.CAN_FilterNumber = 14;
CAN_FilterInitStructure.CAN_FilterFIFOAssignment = 1; //关联FIFO1
CAN_FilterInit(&CAN_FilterInitStructure);
2. Enable CAN interrupt
/* IT Configuration for CAN1 */
CAN_ITConfig(CAN1, CAN_IT_FMP0, ENABLE);
CAN_ITConfig(CAN1, CAN_IT_FMP1, ENABLE);
/* IT Configuration for CAN2 */
CAN_ITConfig(CAN2, CAN_IT_FMP0, ENABLE);
CAN_ITConfig(CAN2, CAN_IT_FMP1, ENABLE);
3. Interrupt handling function
void CAN1_RX0_IRQHandler(void)
{
CAN_Receive(CAN1, CAN_FIFO0, &CAN1_RxMsg);
//
}
void CAN1_RX1_IRQHandler(void)
{
CAN_Receive(CAN1, CAN_FIFO1, &CAN1_RxMsg);
//
}
void CAN2_RX0_IRQHandler(void)
{
CAN_Receive(CAN2, CAN_FIFO0, &CAN2_RxMsg);
//
}
void CAN2_RX1_IRQHandler(void)
{
CAN_Receive(CAN2, CAN_FIFO1, &CAN2_RxMsg);
//
}
Previous article:assert_param function in STM32
Next article:Bitband operation in STM32
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Extreme point test
- Cost-effective testing method with TI-PMLK BUCK experiment board
- Urgently looking for VL6180X Chinese version manual
- Urgent help!!! About the calculation of the inductance of the switching power supply transformer
- R16-Startup Manual
- Header files in C language
- [RVB2601 Creative Application Development] 1. Unboxing
- Can't find the target microcontroller, please give me some advice, thank you
- dsp 28335 ConfigCpuTimer() detailed introduction
- TMS320C6678 ZYNQ Development Manual camera_edge_display video case