<var id="fnfpo"><source id="fnfpo"></source></var>
<rp id="fnfpo"></rp>

<em id="fnfpo"><object id="fnfpo"><input id="fnfpo"></input></object></em>
<em id="fnfpo"><acronym id="fnfpo"></acronym></em>
  • <th id="fnfpo"><track id="fnfpo"></track></th>
  • <progress id="fnfpo"><track id="fnfpo"></track></progress>
  • <tbody id="fnfpo"><pre id="fnfpo"></pre></tbody>

  • x
    x
    查看: 2323|回復: 0
    打印 上一主題 下一主題

    飛凌嵌入式分享丨全志 A40i / T3對CAN的支持

    [復制鏈接]
    跳轉到指定樓層
    樓主
    發表于 2021-12-8 09:12:00 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
    關鍵詞: 飛凌嵌入式
    [color=rgb(51, 51, 51) !important]全志A40i或者T3的CPU中無CAN控制器,而在實際使用過程中,會用到CAN,通常會采用SPI轉CAN的方式。

    在OKA40i-C底板上,有一路SPI,但由于電壓與mcp2515的電壓不匹配,所以會采用串口2的這組復用為SPI外接mcp2515模塊。
    [color=rgb(51, 51, 51) !important]根據CPU手冊第三章描述,可以將PI17-19復用為SPI1,采用PH08作為中斷。
    [color=rgb(51, 51, 51) !important]A40i/T3采用sys_config.fex或者dts 配置引腳復用功能,下面我們采用dts 進行配置。

    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]同時修改設備樹:

    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配置,默認已支持,此處不再說明。

    03-配置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]重新編譯,并打包鏡像,燒錄。

    04-測試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文件。

    注意事項
    [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

    您需要登錄后才可以回帖 登錄 | 立即注冊

    本版積分規則

    關于我們  -  服務條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯系我們
    電子工程網 © 版權所有   京ICP備16069177號 | 京公網安備11010502021702
    快速回復 返回頂部 返回列表
    精品一区二区三区自拍图片区_国产成人亚洲精品_亚洲Va欧美va国产综合888_久久亚洲国产精品五月天婷