找回密码
 注册
关于网站域名变更的通知
查看: 208|回复: 1
打印 上一主题 下一主题

飞凌全志 A40i / T3对CAN的支持

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2021-12-8 09:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
[color=rgb(51, 51, 51) !important]全志A40i或者T3的CPU中无CAN控制器,而在实际使用过程中,会用到CAN,通常会采用SPI转CAN的方式。
1 d& X2 _8 B, x# ]0 }. v
在OKA40i-C底板上,有一路SPI,但由于电压与mcp2515的电压不匹配,所以会采用串口2的这组复用为SPI外接mcp2515模块。
! E; o3 w- C( B% ?
[color=rgb(51, 51, 51) !important]根据CPU手册第三章描述,可以将PI17-19复用为SPI1,采用PH08作为中断。
[color=rgb(51, 51, 51) !important]A40i/T3采用sys_config.fex或者dts 配置引脚复用功能,下面我们采用dts 进行配置。
( n- h- {( Y! u! W
01-打开SPI1
[color=rgb(51, 51, 51) !important]修改sys_config.fex,将uart2的配置去掉,打开SPI1的配置。
[color=rgb(51, 51, 51) !important]同时将PH08注释掉:
[color=rgb(51, 51, 51) !important]同时修改设备树:
- M4 ?4 g  w* i& v6 o
02-修改defconfig
[color=rgb(51, 51, 51) !important]采用通过其他平台验证,且适配设备树的驱动mcp251x.c,
[color=rgb(51, 51, 51) !important]修改defconfig 配置文件:
[color=rgb(51, 51, 51) !important]Networking support ---> CAN bussubsystem support--->CAN Device Drivers --->Microchip MCP251x SPI CAN controllers选中。
[color=rgb(51, 51, 51) !important]同时选中SPI配置,默认已支持,此处不再说明。

/ K# H5 z* s; \1 W8 z03-配置iproute
[color=rgb(51, 51, 51) !important]文件系统:
[color=rgb(51, 51, 51) !important]buildroot-201611/configs/sun8iw11p1_hf_defconfig
[color=rgb(51, 51, 51) !important]需要配置上BR2_PACKAGE_IPROUTE2=y.
[color=rgb(51, 51, 51) !important]重新编译,并打包镜像,烧录。

# ^' N* V8 n! s; y2 t( N! l04-测试can0节点
[color=rgb(51, 51, 51) !important]启动之后,ifconfig 查看出现can0节点。使用以下命令进行测试:
[color=rgb(51, 51, 51) !important]ifconfig can0 down
[color=rgb(51, 51, 51) !important]ip link set can0 up type can bitrate 125000 triple-sampling on
[color=rgb(51, 51, 51) !important]ifconfig can0 up
[color=rgb(51, 51, 51) !important]cansend can0 123#12345678
[color=rgb(51, 51, 51) !important]candump can0
[color=rgb(51, 51, 51) !important]如果有必要请联系飞凌技术服务人员,提供patch文件。

0 c# u& g* f: L& e' V注意事项
[color=rgb(51, 51, 51) !important]在设备树中,用作中断时,因A40i/T3只能使用PH组的引脚复用为中断,在设备树中设置中断时的如下:
[color=rgb(51, 51, 51) !important]interrupt-parent = <&pio>;
[color=rgb(51, 51, 51) !important]interrupts = <8 0>;
[color=rgb(51, 51, 51) !important]另外,需要注意驱动中的中断触发方式。
[color=rgb(51, 51, 51) !important]原文链接:https://www.forlinx.com/article_view_794.html

9 t2 m  Y, w1 Y( X0 E6 m( Y, A

该用户从未签到

2#
发表于 2021-12-8 13:07 | 只看该作者
A40i/T3采用sys_config.fex或者dts 配置引脚复用功能
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-10-9 15:37 , Processed in 0.109375 second(s), 23 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表