当前位置:网站首页>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
边栏推荐
- 【ACM】509. 斐波那契数(dp五部曲)
- 函数递归以及趣味问题的解决
- Dock installation redis
- WiFi ap6212 driver transplantation and debugging analysis technical notes
- Rust: how to implement a thread pool?
- Robocode tutorial 3 - Robo machine analysis
- PowerDesigner various font settings; Preview font setting; SQL font settings
- Use of regular expressions in QT
- C medium? This form of
- Resolves the interface method that allows annotation requests to be written in postman
猜你喜欢
Robocode tutorial 7 - Radar locking
Qt读写XML文件(含源码+注释)
Stm32mp157 wm8960 audio driver debugging notes
With the use of qchart, the final UI interface can be realized. The control of qweight can be added and promoted to a user-defined class. Only the class needs to be promoted to realize the coordinate
由tcl脚本生成板子对应的vivado工程
Use of regular expressions in QT
JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
Robocode tutorial 5 - enemy class
A few lines of code teach you to crawl lol skin pictures
STM32学习记录0008——GPIO那些事1
随机推荐
mysql自动启动设置用Systemctl start mysqld启动
Box pointer of rust
Crawler for querying nicknames and avatars based on qqwebapi
Daily CISSP certification common mistakes (April 11, 2022)
Daily network security certification test questions (April 14, 2022)
QT excel operation summary
Docker installation MySQL
STM32学习记录0008——GPIO那些事1
ArcGIS license error -15 solution
What are the relationships and differences between threads and processes
Error reported when running tensorboard: valueerror: duplicate plugins for name projector, solution
Mysql database backup command -- mysqldump
Correct opening method of option
Function recursion and solving interesting problems
【ACM】509. 斐波那契数(dp五部曲)
Introduction to QT programming
With the use of qchart, the final UI interface can be realized. The control of qweight can be added and promoted to a user-defined class. Only the class needs to be promoted to realize the coordinate
QT add external font ttf
深度学习经典网络解析目标检测篇(一):R-CNN
Win1远程出现“这可能是由于credssp加密oracle修正”解决办法