当前位置:网站首页>全志A40i/T3如何通过SPI转CAN
全志A40i/T3如何通过SPI转CAN
2022-07-03 00:02:00 【ningmengzier】
全志A40i或者T3的CPU中无CAN控制器,而在实际使用过程中,会用到CAN,通常会采用SPI转CAN的方式。
本文基于飞凌嵌入式OKA40i-C开发板进行操作,其他品牌开发板可视情况参考。
在OKA40i-C底板上,有一路SPI,但由于电压与mcp2515的电压不匹配,所以会采用串口2的这组复用为SPI外接mcp2515模块。
根据CPU手册第三章描述,可以将PI17-19复用为SPI1,采用PH08作为中断。
A40i/T3采用sys_config.fex或者dts 配置引脚复用功能,下面我们采用dts 进行配置。
01-打开SPI1
修改sys_config.fex,将uart2的配置去掉,打开SPI1的配置。
同时将PH08注释掉:
同时修改设备树:
02-修改defconfig
采用通过其他平台验证,且适配设备树的驱动mcp251x.c,
修改defconfig 配置文件:
Networking support ---> CAN bus subsystem support --->CAN Device Drivers --->Microchip MCP251x SPI CAN controllers选中。
同时选中SPI配置,默认已支持,此处不再说明。
03-配置iproute
文件系统:
buildroot-201611/configs/sun8iw11p1_hf_defconfig
需要配置上BR2_PACKAGE_IPROUTE2=y.
重新编译,并打包镜像,烧录。
04-测试can0节点
启动之后,ifconfig 查看出现can0节点。使用以下命令进行测试:
ifconfig can0 down ip link set can0 up type can bitrate 125000 triple-sampling on ifconfig can0 up cansend can0 123#12345678 candump can0
如果有必要请联系飞凌技术服务人员,提供patch文件。
注意事项
在设备树中,用作中断时,因A40i/T3只能使用PH组的引脚复用为中断,在设备树中设置中断时的如下:
interrupt-parent = <&pio>; interrupts = <8 0>;
另外,需要注意驱动中的中断触发方式。
边栏推荐
- 【AutoSAR 十 IO架构】
- Test shift right: Elk practice of online quality monitoring
- Baidu AI Cloud takes the lead in building a comprehensive and standardized platform for smart cloud
- 指针初阶(基础)
- Lex & yacc & bison & flex configuration problems
- Tensorflow 2. Chapter 15 of X (keras) source code explanation: migration learning and fine tuning
- Leetcode-1964: find the longest effective obstacle race route to each position
- 关于QByteArray存储十六进制 与十六进制互转
- Free we media essential tools sharing
- leetcode-871:最低加油次数
猜你喜欢
1.12 - Instructions
【AutoSAR 九 C/S原理架构】
[shutter] image component (the placeholder | transparent_image transparent image plug-in is loaded into the memory)
How to systematically learn machine learning
使用jenkins之二Job
University of Oslo: Li Meng | deep reinforcement learning based on swing transformer
Linux软件:如何安装Redis服务
研发一款国产ARM智能边缘计算网关需要什么
mm中的GAN模型架构
Redis21 classic interview questions, extreme pull interviewer
随机推荐
图解网络:什么是虚拟路由器冗余协议 VRRP?
leetcode-241:为运算表达式设计优先级
Tensorflow 2. Chapter 15 of X (keras) source code explanation: migration learning and fine tuning
kubernetes资源对象介绍及常用命令(五)-(NFS&PV&PVC)
[IELTS reading] Wang Xiwei reading P1 (reading judgment question)
Markdown tutorial
Unity learns from spaceshooter to record the difference between fixedupdate and update in unity for the second time
Array common operation methods sorting (including ES6) and detailed use
数组与集合性能比较
The most painful programming problem in 2021, adventure of code 2021 Day24
Rust字符串切片、结构体和枚举类
University of Toronto: Anthony coach | the conditions of deep reinforcement learning can induce dynamic risk measurement
mysql 多表联合删除
Rust所有权(非常重要)
[IELTS reading] Wang Xiwei reading P2 (reading fill in the blank)
How SQLSEVER removes data with duplicate IDS
关于XML一些介绍和注意事项
【JetCache】JetCache的配置说明和注解属性说明
Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
Hdu3507 (slope DP entry)