当前位置:网站首页>全志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>;
另外,需要注意驱动中的中断触发方式。
边栏推荐
- About qbytearray storage hexadecimal and hexadecimal conversion
- There is an unknown problem in inserting data into the database
- Shell 实现文件基本操作(切割、排序、去重)
- One of the reasons why setinterval timer does not take effect in ie: the callback is the arrow function
- 【AutoSAR 四 BSW概述】
- Set up nacos2 X cluster steps and problems encountered
- [IELTS reading] Wang Xiwei reading P1 (reading judgment question)
- cordova-plugin-device获取设备信息插件导致华为审核不通过
- Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
- FAQ | FAQ for building applications for large screen devices
猜你喜欢
随机推荐
leetcode-934:最短的桥
Graduation summary
Tensorflow 2. Chapter 15 of X (keras) source code explanation: migration learning and fine tuning
Overlay of shutter (Pop-Up)
Attributeerror: 'tuple' object has no attribute 'layer' problem solving
University of Toronto: Anthony coach | the conditions of deep reinforcement learning can induce dynamic risk measurement
【AutoSAR 二 AppL概述】
Centos7 one click compilation to build MySQL script
Rust ownership (very important)
字符设备注册常用的两种方法和步骤
瑞萨RZ/G2L 处理器简介|框架图|功耗|原理图及硬件设计指南
【雅思阅读】王希伟阅读P1(阅读判断题)
【AutoSAR 九 C/S原理架构】
Basic use of shell script
leetcode-2115:从给定原材料中找到所有可以做出的菜
Detailed explanation of pod life cycle
Leetcode-241: designing priorities for operational expressions
[shutter] image component (load network pictures | load static pictures | load local pictures | path | provider plug-in)
node_modules删不掉
leetcode-871:最低加油次数