使用官方IIO示波器连接设备,有多种方式可实现。
meta-adi方式:使用adi提供的meta-adi,需要能正常上网,第一次编译时会从github里下载很多东西,修改的东西比较少(改设备树)。
设备树添加方式:需要修改的东西多(设备树、bbpend文件、相关的lib),但是可以离线编译,而且可配置性高。

1.meta-adi方式

1adi移植到yocto layer0必须是Meta-adi/core
2.yotco 的github下载失败解决https://www.arduino.cn/thread-22070-1-1.html经试验本地方式,无效,。
3.BB_NO_WORKbu不能更改,之后的yotco layer会下载adi-linux库在编译成功一次之后可以设置为YES在这里插入图片描述
4.根据readme指示,因为硬件搭建是基于zc702+fmcomms2,所以这里使用最接近的zynq-zc702-adv7511-ad9361-fmcomms5

在这里插入图片描述
之后需要根据自己的设备修改yocto设备树 ,fmcomms5有两个9361所以要修改为如下:
/Delete nodes from pl.dtsi which are redefined in ADI dts/
/ {
/delete-node/ aliases;
};

/delete-node/ &axi_ad9361;
/delete-node/ &misc_clk_0;
/delete-node/ &axi_ad9361_adc_dma;
/delete-node/ &axi_ad9361_dac_dma;
/delete-node/ &axi_hdmi_clkgen;
/delete-node/ &axi_hdmi_core;
/delete-node/ &misc_clk_1;
/delete-node/ &axi_hdmi_dma;
/delete-node/ &axi_iic_main;
/delete-node/ &axi_spdif_tx_core;
/delete-node/ &misc_clk_2;
/delete-node/ &axi_sysid_0;
5.使用上面的设备树,由于删除了 aliases 节点 开机之后会提示找不到 默认输出串口0的 aliases,而官方的默认是串口1,导致之后开机之后不能通过串口0访问设备。不能在这个地方添加aliases节点,需要在system-user.dtsi里添加默认串口0的aliases。配置成功后开机会有iiod在运行的启动信息。
6.在IIO示波器上设置,自动扫描Network 不能识别到设备,需要手动输入
在这里插入图片描述
6.连上示波器后可以通过iio配置设备寄存器等设置,在Debug->Device Selection->Device里可以看到4个设备。此时可以通过ad936x界面配置发送和接收的参数,可以用频谱仪看到发送的信号。之后打开示波器plot界面,发现没有接收到数据,发送界面设置为DAC Buffer Output,load数据后提示不能建立IIObuffer。尝试使用zed+fmcomms2的设备,直接不能启动内核。后面在adi-的linux内核代码里查看zc702和zed使用的设备树的区别:
在这里插入图片描述

修改system-user.dtsi设备树如下

/include/ “system-conf.dtsi”

/ {
aliases{
serial0 = &uart0;
};
chosen {
linux,stdout-path = “serial0:115200n8”;
};
};
&phy0 {
/delete-property/ marvell,reg-init;
};
&cf_ad9361_adc_core_0{
/delete-property/ slavecore-reg ;
};
&cf_ad9361_dac_core_0 {
/delete-property/ slavecore-reg;
};

///delete-node/ &adc0_ad9361;
/delete-node/ &cf_ad9361_adc_core_1;
/delete-node/ &cf_ad9361_dac_core_1;

编译,之后测试正常,LINUX 的IIO示波器移植完成。

2 设备树方式

需要在petalinux-config里设置不自动生成PL端设备树,IIO功能不只是使用AD9361,还包括两个配置的设备。
最终的system_user.dtsi如下:
/include/ “system-conf.dtsi”

#define fmc_spi spi0

&fmc_spi {
status = “okay”;
};

/ {

fpga_axi: fpga-axi@0 {
	compatible = "simple-bus";
	#address-cells = <0x1>;
	#size-cells = <0x1>;
	ranges;


    rx_dma: dma@7c400000 {
	compatible = "adi,axi-dmac-1.00.a";
	reg = <0x7c400000 0x10000>;
	#dma-cells = <1>;
	interrupts = <0 57 0>;
	clocks = <&clkc 16>;

	adi,channels {
		#size-cells = <0>;
		#address-cells = <1>;

		dma-channel@0 {
			reg = <0>;
			adi,source-bus-width = <64>;
			adi,source-bus-type = <2>;
			adi,destination-bus-width = <64>;
			adi,destination-bus-type = <0>;
		};
	};
};

tx_dma: dma@7c420000 {
	compatible = "adi,axi-dmac-1.00.a";
	reg = <0x7c420000 0x10000>;
	#dma-cells = <1>;
	interrupts = <0 56 0>;
	clocks = <&clkc 16>;

	adi,channels {
		#size-cells = <0>;
		#address-cells = <1>;

		dma-channel@0 {
			reg = <0>;
			adi,source-bus-width = <64>;
			adi,source-bus-type = <0>;
			adi,destination-bus-width = <64>;
			adi,destination-bus-type = <2>;
		};
	};
};

cf_ad9361_adc_core_0: cf-ad9361-lpc@79020000 {
	compatible = "adi,axi-ad9361-6.00.a";
	reg = <0x79020000 0x6000>;
	dmas = <&rx_dma 0>;
	dma-names = "rx";

	spibus-connected = <&adc0_ad9361>;
};

cf_ad9361_dac_core_0: cf-ad9361-dds-core-lpc@79024000 {
	compatible = "adi,axi-ad9361-dds-6.00.a";
	reg = <0x79024000 0x1000>;
	clocks = <&adc0_ad9361 13>;
	clock-names = "sampl_clk";
	dmas = <&tx_dma 0>;
	dma-names = "tx";
};


};    

};

#include “useradi-fmcomms2.dtsi”

&adc0_ad9361 {
en_agc-gpios = <&gpio0 98 0>;
sync-gpios = <&gpio0 99 0>;
reset-gpios = <&gpio0 100 0>; /* Previously 84 */
enable-gpios = <&gpio0 101 0>;
txnrx-gpios = <&gpio0 102 0>;
};

同时修改adi-fmcomms2.dtsi的内容并保存为useradi-fmcomms2.dtsi,主要是注释掉硬件没有的fmc_i2c相关的内容。
sfdf在这里插入图片描述
在device-tree.bbappend文件里添加如下内容:
SRC_URI += “file://useradi-fmcomms2.dtsi”

配置petalinux-config ,配置使用的内核文件为adi的linux内核。并使用petalinux-config -c kernel --defconfig "filename"将默认配置写入,filename是要使用的默认配置文件,如:petalinux-config -c kernel --defconfig zynq_xcomm_adv7511_defconfig
写入这个配置后,默认没有打开NFS功能,需要重新在内核配置里使能。

上电测试发现IIO_INFO只能识别到ad9361-phy,识别不到另外两个iio设备。猜测与DMA配置有关,DMA使用了中断。cat /proc/interrupts查看中断状态。
在根节点添加:
model = “Xilinx Zynq ZC702”;
interrupt-parent = <&intc>;
最终的system_user.dtsi:

/include/ “system-conf.dtsi”

#define fmc_spi spi0

&fmc_spi {
status = “okay”;
};

/ {
model = “Xilinx Zynq ZC702”;
interrupt-parent = <&intc>;
chosen {
bootargs = “console=ttyPS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait”; ///home/yetob/zynq/rootfs
//bootargs = “console=ttyPS0,115200 root=/dev/nfs rw nfsroot=192.168.1.89:/home/yetob/zynq/qtrootfs ip=192.168.1.109:192.168.1.89:192.168.1.1:255.255.255.0::eth0:off rootwait”;
stdout-path = “serial0:115200n8”;
};

fpga_axi: fpga-axi@0 {
	compatible = "simple-bus";
	#address-cells = <0x1>;
	#size-cells = <0x1>;
	ranges;


rx_dma: dma@7c400000 {
	compatible = "adi,axi-dmac-1.00.a";
	reg = <0x7c400000 0x10000>;
	#dma-cells = <1>;
	interrupts = <0 57 0>;
	clocks = <&clkc 16>;

	adi,channels {
		#size-cells = <0>;
		#address-cells = <1>;

		dma-channel@0 {
			reg = <0>;
			adi,source-bus-width = <64>;
			adi,source-bus-type = <2>;
			adi,destination-bus-width = <64>;
			adi,destination-bus-type = <0>;
		};
	};
};

tx_dma: dma@7c420000 {
	compatible = "adi,axi-dmac-1.00.a";
	reg = <0x7c420000 0x10000>;
	#dma-cells = <1>;
	interrupts = <0 56 0>;
	clocks = <&clkc 16>;

	adi,channels {
		#size-cells = <0>;
		#address-cells = <1>;

		dma-channel@0 {
			reg = <0>;
			adi,source-bus-width = <64>;
			adi,source-bus-type = <0>;
			adi,destination-bus-width = <64>;
			adi,destination-bus-type = <2>;
		};
	};
};

cf_ad9361_adc_core_0: cf-ad9361-lpc@79020000 {
	compatible = "adi,axi-ad9361-6.00.a";
	reg = <0x79020000 0x6000>;
	dmas = <&rx_dma 0>;
	dma-names = "rx";

	spibus-connected = <&adc0_ad9361>;
};

cf_ad9361_dac_core_0: cf-ad9361-dds-core-lpc@79024000 {
	compatible = "adi,axi-ad9361-dds-6.00.a";
	reg = <0x79024000 0x1000>;
	clocks = <&adc0_ad9361 13>;
	clock-names = "sampl_clk";
	dmas = <&tx_dma 0>;
	dma-names = "tx";
};
};    

};

#include “useradi-fmcomms2.dtsi”

&adc0_ad9361 {
en_agc-gpios = <&gpio0 98 0>;
sync-gpios = <&gpio0 99 0>;
reset-gpios = <&gpio0 100 0>; /* Previously 84 */
enable-gpios = <&gpio0 101 0>;
txnrx-gpios = <&gpio0 102 0>;
};

上电测试,正常。设备树方式移植完成。

GitHub 加速计划 / li / linux-dash
6
1
下载
A beautiful web dashboard for Linux
最近提交(Master分支:3 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐