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: 
Highlighted
Adventurer
Adventurer
11,383 Views
Registered: ‎05-29-2015

Uartlite and Linux-Xilinx

Has anyone been able to get uartLite working on the microzed using the linux-xilinx build? I've browsed around the forums a bit and found some stuff that's promising. I'm currently running the 3.14 kernel, which works, I can't get the latest kernel to work at all. I've ported over the latest changes that I could find to uartlite.c in the git master source tree. The two uarts we have set up show up under: /dev/ttyUL0 and /dev/ttyUL1, however when accessing them everything freezes up. A simple stty -F /dev/ttyUL0 causes the entire kernel to lock up. I have the interrupts mapped to IRQ 61 and 62 in my Vivado project, which corresponds to interrupts = <0 30 4> and <0 31 4> in our device tree; is this correct? Is there something I'm missing? Here's the devicetree setup for the two uarts, with some questions and comments in red:

 

        serial@42C00000 {
            compatible = "xlnx,axi-uartlite-1.02.a";   <<Added to the compatible section of uartlite.c
            reg = <0x42C00000 0x10000>;
            interrupt-parent = <&intc>;                     <<Set from other settings in devicetree?
            interrupts = <0 30 4>;
            clock = <100000000>;                           <<<PL clock speed or PS clock speed???
        };
 
        serial@42C10000 {
            compatible = "xlnx,axi-uartlite-1.02.a";
            reg = <0x42C10000 0x10000>;
            interrupt-parent = <&intc>;
            interrupts = <0 31 4>;
            clock = <100000000>;
        };   

 

Attached is the relevant section of the Vivado project.

0 Kudos
8 Replies
Adventurer
Adventurer
11,360 Views
Registered: ‎05-29-2015

Re: Uartlite and Linux-Xilinx

That should read: "mapped to IRQ 62 and 63"
0 Kudos
Adventurer
Adventurer
11,315 Views
Registered: ‎02-14-2014

Re: Uartlite and Linux-Xilinx

I've given up on uartlite because of their interrupts: they have edge triggered interrupts, and everything else in an AXI zynq system uses level-sensitive interrupts.  They kind of look like they work sometimes but interrupts are missed.

 

Try it with 16550 UART cores instead.  A little more resource use but the interrupts work better, and can be shared. ( OR multiple of them onto a single interrupt - then modify the generated device tree)

 

 

0 Kudos
Adventurer
Adventurer
11,297 Views
Registered: ‎05-29-2015

Re: Uartlite and Linux-Xilinx

Thanks for the response, I'll give those a shot. Do you know what the devicetree entries should like for those UARTs?

0 Kudos
Adventurer
Adventurer
11,219 Views
Registered: ‎05-29-2015

Re: Uartlite and Linux-Xilinx

I figured it out and got it working. For reference:

 

Devictree Entries for our UARTs (two PS UARTs, two 16550 UARTs):

 

        uart0: serial@e0000000 {
            compatible = "xlnx,xuartps";
            status = "disabled";
            clocks = <&clkc 23>, <&clkc 40>;
            clock-names = "ref_clk", "aper_clk";
            reg = <0xE0000000 0x1000>;
            interrupts = <0 27 4>;
        };

        uart1: serial@e0001000 {
            compatible = "xlnx,xuartps";
            status = "disabled";
            clocks = <&clkc 24>, <&clkc 41>;
            clock-names = "ref_clk", "aper_clk";
            reg = <0xE0001000 0x1000>;
            interrupts = <0 50 4>;
        };
        
        axi_uart0: serial@42A00000 {
            current-speed = <115200>;
            clock-frequency = <100000000>;
            compatible="ns16550a";
            interrupt-parent = <&intc>;
            interrupts = < 0 30 4>;
            reg = < 0x42A00000 0x10000 >;
            reg-offset = <0x1000>;
            reg-shift = <2>;
            xlnx,family = "zynq";
            xlnx,has-external-rclk = <0x0>;
            xlnx,has-external-xin = <0x0>;
            xlnx,is-a-16550 = <0x1>;
            xlnx,s-axi-aclk-freq-hz = <0x5F5E100>;
            xlnx,use-modem-ports = <0x0>;
            xlnx,use-user-ports = <0x0>;
            xlnx,instance = "axi_uart16550_0";
        };

        axi_uart1: serial@42A10000 {
            current-speed = <9600>;
            clock-frequency = <100000000>;
            compatible = "ns16550a";
            interrupt-parent = <&intc>;
            interrupts = < 0 31 4>;
            reg = < 0x42A10000 0x10000 >;
            reg-offset = <0x1000>;
            reg-shift = <2>;
            xlnx,family = "zynq";
            xlnx,has-external-rclk = <0x0>;
            xlnx,has-external-xin = <0x0>;
            xlnx,is-a-16550 = <0x1>;
            xlnx,s-axi-aclk-freq-hz = <0x5F5E100>;
            xlnx,use-modem-ports = <0x0>;
            xlnx,use-user-ports = <0x0>;
            xlnx,instance = "axi_uart16550_1";
        };

 

 

.config (linux-xlnx 3.19 kernel, red are the entries I needed to get the 16550 UARTs to work):

 

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_CONSOLE=y
# CONFIG_SERIAL_8250_DMA is not set
# CONFIG_SERIAL_8250_PCI is not set
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set
# CONFIG_SERIAL_8250_DW is not set
# CONFIG_SERIAL_8250_EM is not set

#
# Non-8250 serial port support
#
# CONFIG_SERIAL_AMBA_PL010 is not set
# CONFIG_SERIAL_AMBA_PL011 is not set
# CONFIG_SERIAL_MAX3100 is not set
# CONFIG_SERIAL_MAX310X is not set
# CONFIG_SERIAL_MFD_HSU is not set
CONFIG_SERIAL_UARTLITE=y
# CONFIG_SERIAL_UARTLITE_CONSOLE is not set
# CONFIG_SERIAL_SH_SCI is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_SERIAL_SCCNXP is not set
# CONFIG_SERIAL_TIMBERDALE is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
# CONFIG_SERIAL_IFX6X60 is not set
# CONFIG_SERIAL_PCH_UART is not set
CONFIG_SERIAL_XILINX_PS_UART=y
CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
# CONFIG_SERIAL_ARC is not set
# CONFIG_SERIAL_RP2 is not set
# CONFIG_SERIAL_FSL_LPUART is not set
# CONFIG_SERIAL_ST_ASC is not set
# CONFIG_TTY_PRINTK is not set
# CONFIG_HVC_DCC is not set
# CONFIG_VIRTIO_CONSOLE is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_HW_RANDOM is not set
CONFIG_XILINX_DEVCFG=y
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_TCG_TPM is not set
CONFIG_DEVPORT=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y

 

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

Re: Uartlite and Linux-Xilinx


@lcameron wrote:

I've given up on uartlite because of their interrupts: they have edge triggered interrupts, and everything else in an AXI zynq system uses level-sensitive interrupts.  They kind of look like they work sometimes but interrupts are missed.


that's funny i have never experienced such a problem, do you know how fast they were happening?

I have triggered interrupts (not bursting though.. ) at down to 4ns and never had any troubles

 

In the device driver:

  if (request_irq (FPGA_IRQ, irq_handler, IRQF_TRIGGER_RISING, "irq", NULL))   
   printk(KERN_INFO "request_irq() failed\n");

to make sure you trigger on the rising edge - and so only call irq_handler once

G.W.,
NIST - Time Frequency metrology
0 Kudos
Contributor
Contributor
10,345 Views
Registered: ‎09-24-2015

Re: Uartlite and Linux-Xilinx


@rdemara wrote:

I figured it out and got it working. For reference:

 

Devictree Entries for our UARTs (two PS UARTs, two 16550 UARTs):

 

        uart0: serial@e0000000 {
            compatible = "xlnx,xuartps";
            status = "disabled";
            clocks = <&clkc 23>, <&clkc 40>;
            clock-names = "ref_clk", "aper_clk";
            reg = <0xE0000000 0x1000>;
            interrupts = <0 27 4>;
        };

        uart1: serial@e0001000 {
            compatible = "xlnx,xuartps";
            status = "disabled";
            clocks = <&clkc 24>, <&clkc 41>;
            clock-names = "ref_clk", "aper_clk";
            reg = <0xE0001000 0x1000>;
            interrupts = <0 50 4>;
        };
        
        axi_uart0: serial@42A00000 {
            current-speed = <115200>;
            clock-frequency = <100000000>;
            compatible="ns16550a";
            interrupt-parent = <&intc>;
            interrupts = < 0 30 4>;
            reg = < 0x42A00000 0x10000 >;
            reg-offset = <0x1000>;
            reg-shift = <2>;
            xlnx,family = "zynq";
            xlnx,has-external-rclk = <0x0>;
            xlnx,has-external-xin = <0x0>;
            xlnx,is-a-16550 = <0x1>;
            xlnx,s-axi-aclk-freq-hz = <0x5F5E100>;
            xlnx,use-modem-ports = <0x0>;
            xlnx,use-user-ports = <0x0>;
            xlnx,instance = "axi_uart16550_0";
        };

        axi_uart1: serial@42A10000 {
            current-speed = <9600>;
            clock-frequency = <100000000>;
            compatible = "ns16550a";
            interrupt-parent = <&intc>;
            interrupts = < 0 31 4>;
            reg = < 0x42A10000 0x10000 >;
            reg-offset = <0x1000>;
            reg-shift = <2>;
            xlnx,family = "zynq";
            xlnx,has-external-rclk = <0x0>;
            xlnx,has-external-xin = <0x0>;
            xlnx,is-a-16550 = <0x1>;
            xlnx,s-axi-aclk-freq-hz = <0x5F5E100>;
            xlnx,use-modem-ports = <0x0>;
            xlnx,use-user-ports = <0x0>;
            xlnx,instance = "axi_uart16550_1";
        };

 

 

.config (linux-xlnx 3.19 kernel, red are the entries I needed to get the 16550 UARTs to work):

 

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_CONSOLE=y
# CONFIG_SERIAL_8250_DMA is not set
# CONFIG_SERIAL_8250_PCI is not set
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set
# CONFIG_SERIAL_8250_DW is not set
# CONFIG_SERIAL_8250_EM is not set

#
# Non-8250 serial port support
#
# CONFIG_SERIAL_AMBA_PL010 is not set
# CONFIG_SERIAL_AMBA_PL011 is not set
# CONFIG_SERIAL_MAX3100 is not set
# CONFIG_SERIAL_MAX310X is not set
# CONFIG_SERIAL_MFD_HSU is not set
CONFIG_SERIAL_UARTLITE=y
# CONFIG_SERIAL_UARTLITE_CONSOLE is not set
# CONFIG_SERIAL_SH_SCI is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_SERIAL_SCCNXP is not set
# CONFIG_SERIAL_TIMBERDALE is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
# CONFIG_SERIAL_IFX6X60 is not set
# CONFIG_SERIAL_PCH_UART is not set
CONFIG_SERIAL_XILINX_PS_UART=y
CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
# CONFIG_SERIAL_ARC is not set
# CONFIG_SERIAL_RP2 is not set
# CONFIG_SERIAL_FSL_LPUART is not set
# CONFIG_SERIAL_ST_ASC is not set
# CONFIG_TTY_PRINTK is not set
# CONFIG_HVC_DCC is not set
# CONFIG_VIRTIO_CONSOLE is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_HW_RANDOM is not set
CONFIG_XILINX_DEVCFG=y
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_TCG_TPM is not set
CONFIG_DEVPORT=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y

 


Hello. I am a newbie. And I have installed xillinux 1.3 on my microzed board and I have enabled both the serial ports on the microzed. Now, I need additional serial ports. SO I need to implement them on the FPGA. I came across your post, and I waant to implement these 4 serial ports that you have implemented on my xillinux platform. I need to use custom IP core as xillybus IP core doesnt allow me to add these PS UARTs or 16550 UARTs in the demo version. I can follow the pdf you have posted to create the logic and generate the bit file. Also, I can add the code you have posted below to my devicetree.dts file, compile it and add it to the boot partition. Now, my question is how do I configure the linux kernel to detect these ports on my xillinux OS ? What are the commands to access the linux kernel  config file and make changes to it as you have mentioned below. Do I need to rebuild it or something after making chnages to the config file ? Or overall, do I just need to just make changes to config file to detect tty. 

 

Tags (4)
0 Kudos
Adventurer
Adventurer
10,324 Views
Registered: ‎06-10-2014

Re: Uartlite and Linux-Xilinx

Hello,

 

The kernel that arrives with Xillinux-1.3 supports both 8250 and UART Lite out of the box. There is no need to recompile it or do anything like that. Unlike the suggestion above, the drivers are configured as kernel modules, but this is transparent to the user: The modules are loaded automatically when a corresponding entry exists in the device tree.

 

From the .config file used in Xillinux:

 

#
# Serial drivers
#
CONFIG_SERIAL_8250=m
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_DMA=y
CONFIG_SERIAL_8250_PCI=m
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
# CONFIG_SERIAL_8250_SHARE_IRQ is not set
# CONFIG_SERIAL_8250_DETECT_IRQ is not set
# CONFIG_SERIAL_8250_RSA is not set
CONFIG_SERIAL_8250_DW=m
CONFIG_SERIAL_8250_EM=m

 

and also

 

CONFIG_SERIAL_UARTLITE=m

 

Regards,

   Eli

0 Kudos
Contributor
Contributor
10,315 Views
Registered: ‎09-24-2015

Re: Uartlite and Linux-Xilinx

8250 implies UART 16550, right ?

0 Kudos