发新帖本帖赏金 20.00元(功能说明)我要提问
返回列表
打印
[开发工具]

SAMA5D3 Xplained开发板设备树及硬件配置解析

[复制链接]
4844|10
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
poison0|  楼主 | 2024-2-23 14:55 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 poison0 于 2024-2-23 15:04 编辑

#申请原创# @21小跑堂

SAMA5D3 Xplained 开发板是由 Atmel 公司(现为 Microchip Technology)设计的一款嵌入式系统开发板,使用 SAMA5D3 系列处理器。
各个部位的应用:




设备树文件(at91-sama5d3_xplained.dts)是用于SAMA5D3 Xplained开发板的描述文件,定义了硬件配置和连接信息。
以下是对设备树的简要解析:

  • 硬件配置:

    • 设备树包括了主频、时钟配置、存储器映射等信息,为SAMA5D3 Xplained开发板提供了全面的硬件描述。

  • 外设配置:

    • 配置了多个外设,如MMC、SPI、CAN、Timer、I2C、Ethernet、PWM、USART等,展示了这些外设的初始化和连接方式。

  • 网络配置:

    • 定义了两个以太网接口(macb0和ksz9477),并描述了它们的连接方式、速度、双工模式等信息。

  • 电源管理:

    • 包括了电源管理部分,描述了不同电源的配置,如VCC_1V8、VCC_1V2、VCC_3V3等。

  • 用户接口:

    • 配置了用户接口,包括GPIO按键(PB_USER)和LED灯(d2、d3),并定义了其触发方式和中断设置。

  • 存储器分区:

    • 定义了存储器分区,包括at91bootstrap、bootloader、设备树、内核、根文件系统等。


此解析有助于理解SAMA5D3 Xplained开发板的硬件组成、外设配置和连接方式,为软件开发提供硬件抽象层的基础。

该板子的设备树文件及硬件配置描述了系统的硬件组件和连接关系,为 Linux 内核提供了必要的信息以正确配置和管理硬件。

下面是对该设备树文件的解析:

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* at91-sama5d3_xplained.dts - Device Tree file for the SAMA5D3 Xplained board
*
*  Copyright (C) 2014 Atmel,
*                  2014 Nicolas Ferre <nicolas.ferre@atmel.com>
*/
/dts-v1/;
#include "sama5d36.dtsi"
#include <dt-bindings/input/input.h>

/ {
        model = "SAMA5D3 Xplained";
        compatible = "atmel,sama5d3-xplained", "atmel,sama5d3", "atmel,sama5";

        // Chosen node specifies the default output path for the console
        chosen {
                stdout-path = "serial0:115200n8";
        };

        // Memory configuration
        memory@20000000 {
                reg = <0x20000000 0x10000000>;
        };

        // Clock configuration
        clocks {
                slow_xtal {
                        clock-frequency = <32768>;
                };

                main_xtal {
                        clock-frequency = <12000000>;
                };
        };

        // Advanced High-performance Bus (AHB) configuration
        ahb {
                apb {
                        // Configuration for MMC0 (SD Card)
                        mmc0: mmc@f0000000 {
                                // Pin control configuration for MMC0
                                pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_dat4_7 &pinctrl_mmc0_cd>;
                                vmmc-supply = <&vcc_mmc0_reg>;
                                vqmmc-supply = <&vcc_3v3_reg>;
                                status = "okay";
                                slot[url=home.php?mod=space&uid=2514928]@0[/url] {
                                        reg = <0>;
                                        bus-width = <8>;
                                        cd-gpios = <&pioE 0 GPIO_ACTIVE_LOW>;
                                };
                        };

                        // Configuration for SPI0
                        spi0: spi@f0004000 {
                                pinctrl-names = "default", "cs";
                                pinctrl-1 = <&pinctrl_spi0_cs>;
                                cs-gpios = <&pioD 13 GPIO_ACTIVE_LOW>, <0>, <0>, <&pioD 16 GPIO_ACTIVE_LOW>;
                                status = "okay";
                        };

                        // Configuration for CAN0
                        can0: can@f000c000 {
                                status = "okay";
                        };

                        // Configuration for Timer Counter Block 0 (TCB0)
                        tcb0: timer@f0010000 {
                                timer0: timer[url=home.php?mod=space&uid=2514928]@0[/url] {
                                        compatible = "atmel,tcb-timer";
                                        reg = <0>;
                                };

                                timer1: timer[url=home.php?mod=space&uid=2514798]@1[/url] {
                                        compatible = "atmel,tcb-timer";
                                        reg = <1>;
                                };
                        };

                        // Configuration for I2C0
                        i2c0: i2c@f0014000 {
                                pinctrl-0 = <&pinctrl_i2c0_pu>;
                                status = "okay";

                                // Configuration for Microchip KSZ9477 Ethernet Switch
                                i2c_ksz9477: ksz9477@5f {
                                        compatible = "microchip,ksz9477";
                                        reg = <0x5f>;

                                        interrupt-parent = <&pioB>;
                                        interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
                                        status = "okay";

                                        ports {
                                                #address-cells = <1>;
                                                #size-cells = <0>;

                                                // Ethernet ports configuration
                                                port@0 {
                                                        reg = <0>;
                                                        label = "lan1";
                                                        phy-handle = <&swphy_0>;
                                                };
                                                port[url=home.php?mod=space&uid=2514798]@1[/url] {
                                                        reg = <1>;
                                                        label = "lan2";
                                                        phy-handle = <&swphy_1>;
                                                };
                                                // ... (similar configuration for other ports)
                                                port@5 {
                                                        reg = <5>;
                                                        label = "cpu";
                                                        ethernet = <&macb0>;
                                                        phy-mode = "rgmii-txid";
                                                        tx-internal-delay-ps = <2000>;
                                                        fixed-link {
                                                                speed = <1000>;
                                                                full-duplex;
                                                                pause;
                                                        };
                                                };
                                                // ...
                                        };

                                        // MDIO configuration for Ethernet PHYs
                                        mdio {
                                                #address-cells = <1>;
                                                #size-cells = <0>;
                                                swphy_0: ethernet-phy@0 {
                                                        reg = <0>;
                                                        eee-broken-100tx;
                                                        eee-broken-1000t;
                                                };
                                                // ... (similar configuration for other PHYs)
                                                swphy_4: ethernet-phy[url=home.php?mod=space&uid=26072]@4[/url] {
                                                        reg = <4>;
                                                        eee-broken-100tx;
                                                        eee-broken-1000t;
                                                };
                                        };
                                };
                        };

                        // Configuration for I2C1
                        i2c1: i2c@f0018000 {
                                status = "okay";

                                // Configuration for PMIC
                                pmic: act8865@5b {
                                        compatible = "active-semi,act8865";
                                        reg = <0x5b>;
                                        status = "disabled";

                                        regulators {
                                                // Regulator configurations
                                                vcc_1v8_reg: DCDC_REG1 {
                                                        regulator-name = "VCC_1V8";
                                                        regulator-min-microvolt = <1800000>;
                                                        regulator-max-microvolt = <1800000>;
                                                        regulator-always-on;
                                                };
                                                // ... (similar configuration for other regulators)
                                        };
                                };
                        };

                        // Configuration for MACB0 (Ethernet)
                        macb0: ethernet@f0028000 {
                                phy-mode = "rgmii-txid";
                                #address-cells = <1>;
                                #size-cells = <0>;
                                status = "okay";

                                // Fixed link configuration for MACB0
                                fixed-link {
                                                                        speed = <1000>;
                                        full-duplex;
                                        pause;
                                };
                        };
                };
        };
};




  • Chosen节点: 该节点用于指定默认的控制台输出路径,这里指定为"serial0:115200n8",表示串口输出。
  • Memory节点: 描述内存配置,指定了内存的基地址和大小。
  • Clocks节点: 包含了系统中使用的时钟源的配置,包括慢时钟(slow_xtal)和主时钟(main_xtal)的频率。
  • AHB节点: 包含了高级高性能总线(Advanced High-performance Bus)的配置。

    • MMC0节点: 配置了SD卡(MMC0)的参数,包括引脚控制和供电配置。
    • SPI0节点: 配置了SPI0外设的引脚控制和CS引脚。
    • CAN0节点: 配置了CAN0外设。
    • TCB0节点: 配置了定时器计数器块0,包括两个定时器(timer0和timer1)。
    • I2C0节点: 配置了I2C0外设,以及与之相关的Microchip KSZ9477以太网交换机的信息。包括引脚控制、中断、以及各个端口的配置和PHY(物理层)信息。
    • I2C1节点: 配置了I2C1外设,主要是与PMIC(电源管理集成电路)的通信。
    • MACB0节点: 配置了以太网MACB0,包括PHY模式和固定链接的参数。在这里,apb节点包含了多个外设的配置,如MMC0、SPI0、CAN0、TCB0、I2C0、I2C1、以及MACB0。

这些配置信息在设备树中以一种结构化的方式描述了硬件的连接和配置,使Linux内核能够正确地初始化和使用这些硬件组件。

对于嵌入式系统的开发非常重要,因硬件配置的变化需要修改设备树而不必修改内核源代码。















  

使用特权

评论回复

打赏榜单

21小跑堂 打赏了 20.00 元 2024-02-29
理由:恭喜通过原创审核!期待您更多的原创作品~

评论
21小跑堂 2024-2-29 17:20 回复TA
很漂亮的一款嵌入式开发板,通过结构化的方式使其开发时不必修改内核源码 
沙发
实际测量不符| | 2024-2-24 11:12 | 只看该作者
Chosen 节点:

该节点指定了默认的输出路径为 "serial0:115200n8",表示串口输出,用于控制台信息的显示。这个默认可以改变吗?

使用特权

评论回复
板凳
OliviaSH| | 2024-2-25 20:47 | 只看该作者
实际测量不符 发表于 2024-2-24 11:12
Chosen 节点:

该节点指定了默认的输出路径为 "serial0:115200n8",表示串口输出,用于控制台信息的显示。 ...

修改配置文件就可以

使用特权

评论回复
地板
单片小菜| | 2024-3-1 17:09 | 只看该作者
这个板子感觉有FPGA的作用了

使用特权

评论回复
5
勇敢的大白菜| | 2024-3-4 10:38 | 只看该作者
需要进行配置文件的修改,才是可以的。

使用特权

评论回复
6
小明的同学| | 2024-3-26 22:00 | 只看该作者
支持网络开发的。

使用特权

评论回复
7
hehhehee| | 2024-3-27 00:31 | 只看该作者
硬件配置的变化需要修改设备树而不必修改内核源代码

使用特权

评论回复
8
xuanhuanzi| | 2024-3-30 15:36 | 只看该作者
看着更适合跑OS。

使用特权

评论回复
9
huangcunxiake| | 2024-4-13 18:23 | 只看该作者
Linux?

使用特权

评论回复
10
天灵灵地灵灵| | 2024-4-29 22:41 | 只看该作者
官方开发板吗

使用特权

评论回复
发新帖 本帖赏金 20.00元(功能说明)我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

70

主题

624

帖子

2

粉丝