当前位置:网站首页>Domestic GD chip can filter
Domestic GD chip can filter
2022-04-23 18:22:00 【Things will turn when they reach the extreme 1024】
GD Chip replacement ST Chip time ,ST Of CAN Filter program not available
Here is CANopen Commonly used CANID Filter
Running environment :
#include “gd32f10x.h”
#include <stdio.h>
#include “gd32f10x_can.h”
#include “gd32f10x_gpio.h”
/*------------------------------------------- // Function name :CAN_Set_Filter // describe : CAN0 filter , The default configuration complies with CANopen Basic instructions Filtering rules 1 CAN ID The lower seven digits of must be the same as Addr Agreement , Others don't care Filtering rules 2 CAN ID Of the 7 Bit must be 1, That is, only 0x80 Can pass Filtering rules 3 CAN ID The lower eight digits of must be 0x00 // Parameters :uint8_t Addr CANopen Of this machine nodeID // Return value : nothing // Function call list : ---------------------------------------------*/
void CAN_Set_Filter(uint8_t Addr)
{
CAN_FCTL(CAN0)|=1<<0; // The filter group works in initialization mode
/* Filtering rules 1 CAN ID The lower seven digits of must be the same as Addr Agreement , Others don't care */
CAN_FW(CAN0)&=~(1<<0); // filter 0 Do not activate
CAN_FSCFG(CAN0)|=1<<0; // The filter bit width is 32 position .
CAN_FMCFG(CAN0)&=~(1<<0); // filter 0 Working in identifier mask bit mode
CAN_FAFIFO(CAN0)&=~(1<<0); // filter 0 Related to FIFO0
CAN_F0DATA0(CAN0)=Addr<<21;//32 position ID
CAN_F0DATA1(CAN0)=(0x7F<<21);//32 position MASK
CAN_FW(CAN0)|=1<<0; // Activate the filter 0
/* Filtering rules 2 CAN ID Of the 7 Bit must be 1, That is, only 0x80 Can pass */
CAN_FW(CAN0)&=~(1<<1); // filter 1 Do not activate
CAN_FSCFG(CAN0)|=1<<1; // filter 1 The seat width is 32 position .
CAN_FMCFG(CAN0)|=(1<<1); // filter 1 Working in identifier list mode
CAN_FAFIFO(CAN0)&=~(1<<1); // filter 1 Related to FIFO0
CAN_F1DATA0(CAN0)=0x80<<21;//32 position ID
CAN_F1DATA1(CAN0)=(0x80<<21);//32 position MASK
CAN_FW(CAN0)|=1<<1; // Activate the filter 1
/* Filtering rules 3 CAN ID The lower eight digits of must be 0x00*/
CAN_FW(CAN0)&=~(1<<2); // filter 2 Do not activate
CAN_FSCFG(CAN0)|=1<<2; // filter 2 The seat width is 32 position .
CAN_FMCFG(CAN0)&=~(1<<2); // filter 2 Working in identifier mask bit mode
//CAN1->FM1R|=1<<2; // filter 2 Working in identifier list mode
CAN_FAFIFO(CAN0)&=~(1<<2); // filter 2 Related to FIFO0
CAN_F2DATA0(CAN0)=0x00<<21;//32 position ID
CAN_F2DATA1(CAN0)=(0xFF<<21);//32 position MASK
CAN_FW(CAN0)|=1<<2; // Activate the filter 2
CAN_FCTL(CAN0)&=~(1<<0); // The filter bank enters normal mode
}
版权声明
本文为[Things will turn when they reach the extreme 1024]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210610056951.html
边栏推荐
- MATLAB从入门到精通(二)
- From source code to executable file
- Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
- WiFi ap6212 driver transplantation and debugging analysis technical notes
- 【ACM】509. 斐波那契数(dp五部曲)
- Rust: shared variable in thread pool
- Docker 安装 Redis
- Implement a simple function to calculate the sum of all integers between M ~ n (m < n)
- Daily network security certification test questions (April 15, 2022)
- Dynamically add default fusing rules to feign client based on sentinel + Nacos
猜你喜欢

Visualization of residential house prices

【ACM】70. climb stairs

Robocode Tutorial 4 - robocode's game physics

How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)

From source code to executable file

PowerDesigner various font settings; Preview font setting; SQL font settings

Nodejs安装

mysql自动启动设置用Systemctl start mysqld启动

WIN1 remote "this may be due to credssp encryption Oracle correction" solution

Promote QT default control to custom control
随机推荐
C medium? This form of
RC smart pointer in rust
Daily CISSP certification common mistakes (April 18, 2022)
【ACM】70. climb stairs
Daily network security certification test questions (April 14, 2022)
Nodejs installation
Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck
ArcGIS license error -15 solution
How to ensure the security of futures accounts online?
Software test summary
Rust: the output information of println is displayed during the unit test
14 py games source code share the second bullet
Gst-launch-1.0 usage notes
According to the result set queried by SQL statement, it is encapsulated as JSON
CISSP certified daily knowledge points (April 18, 2022)
Pyppeter crawler
由tcl脚本生成板子对应的vivado工程
Jenkspy package installation
Ionic instruction set order from creation to packaging
CISSP certified daily knowledge points (April 19, 2022)