ZYNQ7020在linux下UART0、UART1双串口的实现 - ZYNQ7020学习

版权声明:- - 内容若有错误,请您务必指出,感谢让我提高并给予我建议的你! - - 转载请注明出处 https://blog.csdn.net/yishuicanhong/article/details/80213158

基于黑金的多以太网进行的多串口实验,UART0和UART1都使用的是PS端的引脚,不需要进行引脚分配。首先我们先双击ZYNQ核

勾选UART0的引脚如下图所示,其他配置均不用修改,点击OK完成。

然后与正常的工程一样,点击Run Implementation --> 产上Bit流文件 --> 硬件导出 --> 打开SDK。将design_1_wrapper_hw_platform_0文件拷贝到Linux系统下,用以创建petalinux工程。

按照petalinux移植的流程,在petalinux-config -c kernel 配置内核之前,进入到petalinux工程路径下的subsystems/linux/configs/device-tree文件夹,将system-top.dts 修改如下:

/dts-v1/;
/include/ "zynq-7000.dtsi"
/include/ "system-conf.dtsi"
/include/ "pl.dtsi"
/ {
	cpus {
		cpu@0 {
			operating-points = <766666 1000000 383333 1000000>;
		};
	};
	chosen {
		bootargs = "console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=0";
	};
	aliases {
		ethernet0 = &axi_ethernet_1;
		ethernet1 = &axi_ethernet_2;
		ethernet2 = &axi_ethernet_3;
		ethernet3 = &gem0;
		ethernet4 = &axi_ethernet_0;
		serial0 = &uart1;
		serial1 = &uart0;
		spi0 = &qspi;
	};
	memory {
		device_type = "memory";
		reg = <0x0 0x40000000>;
	};
};
&gem0 {
	enet-reset = <&gpio0 7 0>;
	local-mac-address = [00 0a 35 00 00 08];
	phy-mode = "rgmii-id";
	status = "okay";
	xlnx,ptp-enet-clock = <0x79dbbf3>;
};
&gpio0 {
	emio-gpio-width = <64>;
	gpio-mask-high = <0x0>;
	gpio-mask-low = <0x5600>;
};
&intc {
	num_cpus = <2>;
	num_interrupts = <96>;
};
&qspi {
	is-dual = <0>;
	num-cs = <1>;
	status = "okay";
};
&sdhci0 {
	status = "okay";
	xlnx,has-cd = <0x1>;
	xlnx,has-power = <0x0>;
	xlnx,has-wp = <0x0>;
};
&sdhci1 {
	status = "okay";
	xlnx,has-cd = <0x0>;
	xlnx,has-power = <0x0>;
	xlnx,has-wp = <0x0>;
};
&uart0 {
	current-speed = <115200>;
	device_type = "serial";
	port-number = <1>;
	status = "okay";
};
&uart1 {
	current-speed = <115200>;
	device_type = "serial";
	port-number = <0>;
	status = "okay";
};
&usb0 {
	dr_mode = "host";
	phy_type = "ulpi";
	status = "okay";
	usb-reset = <&gpio0 8 0>;
};
&axi_ethernet_0 {
	local-mac-address = [00 0a 35 00 01 22];
	phy-handle = <&phy0>;
	xlnx,has-mdio = <0x1>;
	phy-mode = "rgmii-id";
	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
	phy0: phy@1 {
		compatible = "micrel,ksz9031";
		device_type = "ethernet-phy";
		reg = <1>;
		};
	};
};
&axi_ethernet_1 {
	local-mac-address = [00 0a 35 00 01 23];
	phy-handle = <&phy1>;
	xlnx,has-mdio = <0x1>;
	phy-mode = "rgmii-id";
	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
	phy1: phy@1 {
		compatible = "micrel,ksz9031";
		device_type = "ethernet-phy";
		reg = <1>;
		};
	};
};
&axi_ethernet_2 {
	local-mac-address = [00 0a 35 00 01 24];
	phy-handle = <&phy2>;
	xlnx,has-mdio = <0x1>;
	phy-mode = "rgmii-id";
	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
	phy2: phy@1 {
		compatible = "micrel,ksz9031";
		device_type = "ethernet-phy";
		reg = <1>;
		};
	};
};
&axi_ethernet_3{
	local-mac-address = [00 0a 35 00 01 25];
	phy-handle = <&phy3>;
	xlnx,has-mdio = <0x1>;
	phy-mode = "rgmii-id";
	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
	phy3: phy@1 {
		compatible = "micrel,ksz9031";
		device_type = "ethernet-phy";
		reg = <1>;
		};
	};
};
&clkc {
	fclk-enable = <0x3>;
	ps-clk-frequency = <33333333>;

};

按照petalinux的流程产上BOOT.BIN和image.ub文件拷贝到SD,将开发板设置问SD卡启动就可以从SD卡启动了。这里只是完成了双串口的配置,UART1用作了控制台,UART0的使用还需要自己基于Linux开发可执行文件来使用。下面的界面中是启动时添加了网口的启动配置信息,网线没有插上,所以很多disable,关于UART0编程和启动配置,下次有时间再来写。

猜你喜欢

转载自blog.csdn.net/yishuicanhong/article/details/80213158