UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
11,126 Views
Registered: ‎03-27-2014

Enabling a second UART on ZC706 for AMP (Linux + Baremetal)?

Does the Zynq ZC706 only have a single UART? I have one UART connected via the micro-USB to the PC and able to view messages from the Linux kernel.

 

Now, I am trying to get AMP mode running with Linux on CPU0 and Baremetal on CPU1. Is it possible to get the UART for CPU1 output on some USB/Serial connection? I would like to be able to use that for quick debug with printfs and command enters, if possible.

 

Thanks a lot for any pointers.

0 Kudos
6 Replies
Scholar trenz-al
Scholar
11,109 Views
Registered: ‎11-09-2013

Re: Enabling a second UART on ZC706 for AMP (Linux + Baremetal)?

yes should be, and in the case you have no real UARTs directly available you may also try to use DCC console

0 Kudos
Adventurer
Adventurer
11,102 Views
Registered: ‎03-27-2014

Re: Enabling a second UART on ZC706 for AMP (Linux + Baremetal)?

Thanks. I am taking a look at DCC console now. I am really looking for a dedicated UART for both the CPU to be active simultaneously.

 

If that is not possible then I want to use the USB UART for CPU1 and will do an ssh into the Linux running on CPU0 or just use the keyboard/mouse along with X windows. This is what I am unable to get working.

0 Kudos
Scholar trenz-al
Scholar
11,100 Views
Registered: ‎11-09-2013

Re: Enabling a second UART on ZC706 for AMP (Linux + Baremetal)?

yes you can use ssh console if you have networking setup.

 

I only have used DCC console in u-boot but it should also be available in linux, so either over ssh or dcc you can have your linux console, and the the real uart on bare metal.

 

 

0 Kudos
Adventurer
Adventurer
11,051 Views
Registered: ‎03-27-2014

Re: Enabling a second UART on ZC706 for AMP (Linux + Baremetal)?

I don't think DCC would work for me. I was trying to bring out UART0 but couldn't figure out how.

 

UART-1 is used by Linux on CPU0. I tried to connect UART-0 to EMIO in Vivado Block Design for PS. Then I marked the UART0 port to be external and built a bitstream.

 

Then in the source code, I changed app_cpu1.c where I commented out the function outbyte() and myPutchar(c); as I am assuming that libgen will produce code to write to UART-0 and no custom OCM-based character output is required.

 

What I don't know is where would these characters show up? I get the Linux UART-1 on the USB UART cable connected to PC which shows up as /dev/ttyUSB1 on my Ubuntu host. How about UART-0? Where would the EMIO pins go to? Any ideas?

0 Kudos
Adventurer
Adventurer
11,013 Views
Registered: ‎03-27-2014

Re: Enabling a second UART on ZC706 for AMP (Linux + Baremetal)?

Has anyone been able to route/assign the EMIO pins to some package pins on the Zync ZC7045 and then figure out a good header on the ZC706 board to get UART-0 working?

0 Kudos
Xilinx Employee
Xilinx Employee
11,006 Views
Registered: ‎02-01-2008

Re: Enabling a second UART on ZC706 for AMP (Linux + Baremetal)?

I just gave it a shot and it works based on the early access 2014.2 xapp1078 files.

 

In the vivado block diagram, enable uart0 for emio and then make the uart0 bus external. Recreate the top hdl. Create a constraints file with the following:

set_property IOSTANDARD LVCMOS25 [get_ports UART_0_rxd]
set_property IOSTANDARD LVCMOS25 [get_ports UART_0_txd]
set_property PACKAGE_PIN AJ21 [get_ports UART_0_rxd];    #J58-1 PMOD1_0
set_property PACKAGE_PIN AK21 [get_ports UART_0_txd];    #J58-3 PMOD1_1

Uart0 will now be connected to J58 via 3.3V level shifters. Get an arduino usb to serial adapter that supports 3.3V and connect its gnd, 3.3V to J58 and make sure uart0 tx is connected to usb adapter rx and uart0 rx to adapter tx.

 

Re-implement and generate the bitfile. Export to SDK. Right click on the cpu1 bsp and choose 'board support package settings'. In overview->standalone, change sdtin and stdout to ps7_uart_0. In overview->drivers->ps7_cortexa9_1, remove -DSTDOUT_REDIR=1 from extra_compiler_flags. By default, uart0 will be configured for 115200.

 

Just to be safe, select project->clean and clean all. You can create a simple hello_world for the app.

 

Copy the new .hdf into your petalinux project.

 

Once you run petalinux-config and create the device tree files, you will need to modify them. For this specific purpose of removing uart0 from the devicetree, add the following at the end of subsystems/linux/configs/device-tree/system-top.dts

&ps7_uart_0 {
    status = "disabled";
};

Now do a petalinux-build and you are good to go.

 

BTW: I noticed a problem with the early version of xapp1078 and I will update the wiki page but while you are editing the device tree file, also add the following for the ethernet phy device:

&ps7_ethernet_0 {
        phy-handle = <&phy0>;
        mdio {
                #address-cells = <1>;
                #size-cells = <0>;
                phy0: phy@7 {
                        compatible = "marvell,88e1116r";
                        device_type = "ethernet-phy";
                        reg = <7>;
                } ;
        } ;
};

 

And one last note: if you decided not to use uart0 for cpu1 and wanted to use it for Linux, you need to change the device tree file as follows:

replace:

/ {
};
with:

/ {
    aliases {
        serial0 = &ps7_uart_1;
        serial1 = &ps7_uart_0;
        ethernet0 = &ps7_ethernet_0;
    };
};

This will correctly configure linux to use uart1 for ttyPS0 and uart0 for ttyPS1. The bootargs should not need to be changed. Also keep in mind that by default, Linux will configure uart0 for 9600baud as seen with 'stty -F /dev/ttyPS1'. If you are using both uarts, you can test them using 'echo hello0 >ttyPS0' and 'echo hello1 >ttyPS1'.

 

0 Kudos