cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor
Visitor
474 Views
Registered: ‎07-22-2019

Using UART/USB for communication in Petalinux on Zybo Z7-10

Hello,

 

I am very new to Xilinx SoC, so this may sound bit foolish. I am running a bare minimum Petalinux (2019.2) on a zybo Z7-10. I followed the instructions on ug1144 to build petalinux (no bsp, just a zynq ps in bitstream). Everything is in default configuration. I can both SSH into the petalinux and use GtkTerm to establish serial communication using JTAG port.

What I need to do is to send and receive data over either UART or USB. I have a python program running which is trying to collect data from and send command to an arduino. The data/command is simple string. But when I connect the arduino using JTAG J11 or USB port, it does not show up in /dev/tty*. I first thought that I need to enable the USB in kernel. I tried to search how to do that, but couldn't find a definitive answer. In the kernel config, everything that is mentioned here is selected. I tried to some other solutions like editing the system-top.dts, but didn't work as every time I build petalinux project system-top.dts gets overwritten. I am probably looking at the wrong place and getting more confused.

As an alternative, I was thinking to use PL to do the communication and use a USB-to-TTL converter, but then I found that zybo only has TX/RX in JTAG which can only be used by PS. Is there anyway to establish communication between an arduino and PL? I just need to establish send/receive data from FPGA to arduino, PL or PS doesn't really matter.  

Is their any manual or project that I can use to achieve my goal? I am really lost here, and would appreciate any help. Thanks in advance.

0 Kudos
8 Replies
Highlighted
Observer
Observer
383 Views
Registered: ‎09-10-2018

Re: Using UART/USB for communication in Petalinux on Zybo Z7-10

Have you checked if the usb is set to host mode in the device tree?

Also, changes made to the device tree should be done in system-user.dtsi in project-spec/meta-user/recipes-bsp/device-tree/files.

This will be appended to system-top.dtsi when building.

 

Try and see if appending this to your system/top.dtsi solves your problem:

 

/ {
	usb_phy0: phy0 {
		compatible = "usb-nop-xceiv";
		#phy-cells = <0>;
		reset-gpios = <&gpio0 7 1>; /* MIO 7, GPIO_ACTIVE_LOW */
	};
};

&uart1 {
	status = "okay";
};

&usb0 {
	status = "okay";
	dr_mode = "host";
	usb-phy = <&usb_phy0>;
};
0 Kudos
Highlighted
Visitor
Visitor
353 Views
Registered: ‎07-22-2019

Re: Using UART/USB for communication in Petalinux on Zybo Z7-10

@joaragjThank you for your reply. I appended your code to system-user.dtsi, but the issue persisted. Nothing is showing up in /dev/tty*. Here is my system-user.dtsi

/include/ "system-conf.dtsi"


/ {
	usb_phy0: phy0 {
		compatible = "usb-nop-xceiv";
		#phy-cells = <0>;
		reset-gpios = <&gpio0 7 1>; /* MIO 7, GPIO_ACTIVE_LOW */
	};
};

&uart1 {
	status = "okay";
};

&usb0 {
	status = "okay";
	dr_mode = "host";
	usb-phy = <&usb_phy0>;
};

And here is the system-top.dtsi -

/dts-v1/;
#include "zynq-7000.dtsi"
#include "pcw.dtsi"
/ {
	chosen {
		bootargs = "earlycon";
		stdout-path = "serial0:115200n8";
	};
	aliases {
		ethernet0 = &gem0;
		serial0 = &uart1;
		spi0 = &qspi;
	};
	memory {
		device_type = "memory";
		reg = <0x0 0x40000000>;
	};
};
#include "system-user.dtsi"

Do I need to change anything in the hardware design? It includes a zynq PS with default config.

 

I have attached some other files present in devic-etree directory after build, in case it helps to understand the scenario.

 

Any suggestion is much appreciated.

0 Kudos
Highlighted
Mentor
Mentor
335 Views
Registered: ‎06-16-2013

Re: Using UART/USB for communication in Petalinux on Zybo Z7-10

Hi @smsunny 

 

Would you share the followings, if possible ?

 

- linux kernel arguments (Confirm serial port setting)

- boot log file (make sure whether exist warning and error or not)

- result of "lsusb" on Zybo Z7-10 (make sure whether exist proper usb driver or not)

 

Best regards,

0 Kudos
Highlighted
Visitor
Visitor
277 Views
Registered: ‎07-22-2019

Re: Using UART/USB for communication in Petalinux on Zybo Z7-10

@watari Thank for your reply. Here is the output of "lsusb" on Zybo Z7-10 ( I have a Ubuntu desktop connected at UART and a arduino connected at USB) - 

Bus 001 Device 001: ID 1d6b:002 Linux Foundation 2.0 root hub

I have attached two files here with kernel arguments and boot log. To make sure I have the correct things (I am very new to Linux, sorry if I made a mess here), here are the commands I used to get these files - 

sudo sysctl -a
journalctl -b

One more thing I would like to mention, I measured the voltage of UART and USB port. UART is getting 5V, but the USB is at 0V. So I think that it is almost certainly a driver or enabling issue.

Any help or suggestion is appreciated.

0 Kudos
Highlighted
Mentor
Mentor
262 Views
Registered: ‎06-16-2013

Re: Using UART/USB for communication in Petalinux on Zybo Z7-10

Hi @smsunny 

 

>One more thing I would like to mention, I measured the voltage of UART and USB port. UART is getting 5V, but the USB is at 0V.

 

What gadget name are you using ?

It might be broken...

 

Best regards,

0 Kudos
Highlighted
Visitor
Visitor
240 Views
Registered: ‎07-22-2019

Re: Using UART/USB for communication in Petalinux on Zybo Z7-10

@watari please pardon my ignorence, what did you mean by gadget name? 

0 Kudos
Highlighted
Mentor
Mentor
167 Views
Registered: ‎06-16-2013

Re: Using UART/USB for communication in Petalinux on Zybo Z7-10

Hi @smsunny 

 

Would you explain detail about "USB-to-TTL converter" ?

I guess you use some gadget ex. FTDI 232R...

 

*)

https://dictionary.cambridge.org/us/dictionary/english/gadget

 

Best regards,

0 Kudos
Highlighted
Visitor
Visitor
127 Views
Registered: ‎07-22-2019

Re: Using UART/USB for communication in Petalinux on Zybo Z7-10

@watari Using a "USB-to-TTL converter" is an alternate way I was thinking. I have this converter, but I am not currently using that. I am currently trying to connect a USB 2.0 cable coming from an arduino to the USB port on my zybo z7-10. If this doesn't work, I am open to using the converter instead. But I am not sure how to do that either, as I would need to access RX/TX pin, which is only available to the PS.

0 Kudos