当前位置:网站首页>全志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>;
另外,需要注意驱动中的中断触发方式。
边栏推荐
- An excellent orm in dotnet circle -- FreeSQL
- Test shift right: Elk practice of online quality monitoring
- 微信小程序获取某个元素的信息(高、宽等),并将px转换为rpx。
- Vulkan practice first bullet
- 【案例分享】让新时代教育发展与“数”俱进
- 字符设备注册常用的两种方法和步骤
- 奥斯陆大学:Li Meng | 基于Swin-Transformer的深度强化学习
- Pageoffice - bug modification journey
- 数组与集合性能比较
- 腾讯云免费SSL证书扩展文件含义
猜你喜欢

AEM: Nanlin fan Ben et al. - plant rhizosphere growth promoting bacteria control soybean blight

如何系统学习机器学习

2022上半年值得被看见的10条文案,每一句都能带给你力量!

【AutoSAR 六 描述文件】

One of the reasons why setinterval timer does not take effect in ie: the callback is the arrow function
![[applet project development -- JD mall] user defined search component of uni app (middle) -- search suggestions](/img/ea/ee1ad50a497478b9d080bb5e4bdfb5.png)
[applet project development -- JD mall] user defined search component of uni app (middle) -- search suggestions

Hdu3507 (slope DP entry)

奥斯陆大学:Li Meng | 基于Swin-Transformer的深度强化学习

文件操作IO-Part2
![[shutter] image component (the placeholder | transparent_image transparent image plug-in is loaded into the memory)](/img/73/19e2e0fc5ea6f05e34584ba40a452d.jpg)
[shutter] image component (the placeholder | transparent_image transparent image plug-in is loaded into the memory)
随机推荐
Leetcode-849: maximum distance to the nearest person
How SQLSEVER removes data with duplicate IDS
mysql 多表联合删除
[IELTS reading] Wang Xiwei reading P1 (reading judgment question)
Use Jenkins II job
腾讯云免费SSL证书扩展文件含义
Rust字符串切片、结构体和枚举类
[jetcache] jetcache configuration description and annotation attribute description
Test shift right: Elk practice of online quality monitoring
node_modules删不掉
Basic use of shell script
Thread start and priority
Leetcode-241: designing priorities for operational expressions
Detailed explanation of pod life cycle
AttributeError: ‘tuple‘ object has no attribute ‘layer‘问题解决
Graduation summary
Teach you JDBC hand in hand -- structure separation
研发一款国产ARM智能边缘计算网关需要什么
Two common methods and steps of character device registration
2022上半年值得被看见的10条文案,每一句都能带给你力量!