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: 
Visitor whitsy
Visitor
10,233 Views
Registered: ‎10-02-2015

Axi-uartlite in petalinux 2014.4

Jump to solution

Hello,

I am designing a zynq system on a small industrial Zynq board (Trenz-electronic), and need to add a few Axi-uartlites to my design. In Vivado 2014.4 I build the hardware and in the SDK verified that all 3 of my Axi-uartlites are outputing data. I have had no such luck in outputing data in Petalinux.

The hardware design follows the Uartlite Driver Wiki, with the interrupts from the axi-uartlites concatinated and then or'd. I have modified the sytem-top.dtsi to provide aliases for the 3 uartlites and an interrupt for them.  When booting the device files are added as /dev/ttyUL1, ttyUL2, ttyUL3.  My application can open the device files, but no data is ever output.

I will attach my system.dts file.  Thanks

0 Kudos
1 Solution

Accepted Solutions
Scholar vanmierlo
Scholar
19,122 Views
Registered: ‎06-10-2008

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

I understand that you added the interrupts in system-top.dts, but my advice was to temporarily connect only the first interrupt and let petalinux generate the interrupt so you can compare it to what you entered manually. The tools are smart enough to handle a concatenate in the IPI but not for an OR or AND. Btw. a concatenate can swap the bit-order and offset. I don't remember anymore at which version it changed and how.

 

From your last remark I conclude that you now do have characters coming out of the uartlite, right? If so, is everything ok now or do you have more questions?

17 Replies
Explorer
Explorer
10,224 Views
Registered: ‎02-18-2014

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

How are you currently configuring your axi-uarts in software?

 

Also what baudrate are you setting your axi-uarts to in logic?

0 Kudos
Visitor whitsy
Visitor
10,214 Views
Registered: ‎10-02-2015

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

I have had the baudrate set in hardware to both 9600 and 115200.  In software I wrote an application accesing the device using low level commands (open/close, write). I have also tried: echo hello > /dev/ttyUL1

In my application the device opens and returns the correct amount of data written, but it appears nothing is clocked out of the Uart.

0 Kudos
Explorer
Explorer
10,210 Views
Registered: ‎02-18-2014

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

I'm making the assumption that in hardware and OS that everything seems to be configured properly, i think this is try because your getting the character device nodes through into your /dev/ directorty.

 

It sounds like your just not setting up the port correctly. This can be done through termios, something similar to below is what i've been using:

 

fd = open(file_name, O_RDWR | O_NONBLOCK);

struct termios newtio;

bzero(&newtio, sizeof(newtio)); /* clear struct for new port settings */

newtio.c_cflag = UARTDRIVER_BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;

newtio.c_iflag = 0;

newtio.c_lflag = 0;

newtio.c_cc[VINTR] = 0x03;

newtio.c_cc[VTIME] = 0; /* inter-character timer unused */

newtio.c_cc[VMIN] = 0; /* Do not block waiting for input */

tcflush(fd, TCIOFLUSH);

tcsetattr(fd, TCSANOW, &newtio);

0 Kudos
Visitor whitsy
Visitor
10,199 Views
Registered: ‎10-02-2015

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

No, that did not help. I probed the tx pin when I ran this and saw that the output is high. Could this be a hardware problem?

0 Kudos
Visitor walterdf00
Visitor
10,189 Views
Registered: ‎10-02-2014

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Do you have interrupts hooked up?  I think I remember that the axi-uartlites need that to work successfully in Petalinux.

0 Kudos
Visitor whitsy
Visitor
10,177 Views
Registered: ‎10-02-2015

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Yes I do have the interrupts connected.  I have them all hooked up according to the uartlite driver Wiki (concatenated and the 3 signals or'd into the interrupt.  My device tree specifies the interrupt 61. Without the interrupts in the device tree the device files are never created. 

0 Kudos
Visitor walterdf00
Visitor
10,169 Views
Registered: ‎10-02-2014

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Well, I'm out of ideas.  Let us know what you figure out once you get it working.

0 Kudos
Scholar vanmierlo
Scholar
10,152 Views
Registered: ‎06-10-2008

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

@whitsy wrote:

Yes I do have the interrupts connected.  I have them all hooked up according to the uartlite driver Wiki (concatenated and the 3 signals or'd into the interrupt. My device tree specifies the interrupt 61.


I don't think that's what your uploaded system.dts says.

 

It's always a pain to find out the right interrupt number. Did you let the petalinux tools generate the device-tree? If so, try to connect only one uartlite and see if it creates a proper interrupt line in the device-tree for you. Also check if the uart works then. From there reintroduce the concat & or to this same interrupt line and fill in the top-dtsi.

0 Kudos
Visitor whitsy
Visitor
10,134 Views
Registered: ‎10-02-2015

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Sorry, I uploaded the wrong dts file.  Petalinux did not generate the interrupts in the device tree. I added them in the system-top.dtsi file.  I have the 3 axiUartLites hooked up to 0x3d.

 

So I am getting some text in and out of my uarts. I should using raw input/output for these correct?

0 Kudos
Scholar vanmierlo
Scholar
19,123 Views
Registered: ‎06-10-2008

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

I understand that you added the interrupts in system-top.dts, but my advice was to temporarily connect only the first interrupt and let petalinux generate the interrupt so you can compare it to what you entered manually. The tools are smart enough to handle a concatenate in the IPI but not for an OR or AND. Btw. a concatenate can swap the bit-order and offset. I don't remember anymore at which version it changed and how.

 

From your last remark I conclude that you now do have characters coming out of the uartlite, right? If so, is everything ok now or do you have more questions?

Visitor whitsy
Visitor
9,729 Views
Registered: ‎10-02-2015

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

I do have characters coming out, but my test application does not write out all the characters, it looks like I can only write out 2 chars at a time. I thought the fifo was at least 16 bytes deep?

0 Kudos
Scholar vanmierlo
Scholar
9,714 Views
Registered: ‎06-10-2008

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Can you attach a screenshot of your Block Design so others can have a look?

0 Kudos
Scholar vanmierlo
Scholar
9,709 Views
Registered: ‎06-10-2008

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Also, check the issues at github. The uartlite driver has bugs that don't seem to get fixed. Especially the required spinlock in the ISR.

0 Kudos
Visitor whitsy
Visitor
9,702 Views
Registered: ‎10-02-2015

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Ah-ha. I see what you are saying. I did that and Petalinux did specify a different interrupt. When the zynq boots up my uartlite now reports the interrupt is 61, which I beleive is correct for the version of tools I am using. I still can't output more than 1 character at a time, and cannot receive any characters. If I just try to echo text out the uartlite the call hangs. It will output up to 3 characters and eventually return.  When I check /proc/interrupts I can see the interupt listed, but never any are caught. Is there a way to modify the axi-uartlite interrupt?

0 Kudos
Visitor whitsy
Visitor
9,697 Views
Registered: ‎10-02-2015

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Here is my current design. I have left the 2 extra axi-uartlites, but have disconnected the interrupts.

0 Kudos
Scholar vanmierlo
Scholar
9,685 Views
Registered: ‎06-10-2008

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

So, did the petalinux tools generated pl.dtsi put the interrupt at 59 or 29? That is where I would expect it in your setup. And since you don't use a Concat to combine several interrupts for IRQ_F2P, it doesn't matter which version it has.

 

I suggest to try with 59 first.

 

Btw. This AR#62107 explains the changeover of Concat and how the interrupts are renumbered again and again. And on the wiki is explained how the device tree has 32 subtracted.

 

Device Tree Generator

Xilinx SDK supports the Device Tree Generator for Zynq. For Linux kernel 3.3 and later, the device tree syntax has changed for denoting interrupts. To calculate the correct value in these releases, use Table 7-3 in the Zynq-7000 AP SoC TRM to locate the correct SPI ID# for the desired peripheral. Then, subtract 32 from this value. The result is what should be entered into the device tree interrupt field.

 

It comes down to that your single interrupt at IRQ_F2P[0:0] is mapped to interrupt ID 91 (the highest) or ID 61 (the lowest) and then has 32 subtracted which gives 59 or 29 to be entered in the device tree.

Visitor whitsy
Visitor
9,643 Views
Registered: ‎10-02-2015

Re: Axi-uartlite in petalinux 2014.4

Jump to solution

Thanks for the idea.  In the end I moved to Petalinux 2015.2. It did not work at first, I used my old system-top.dts that specified interrupts for all the axi-uartlites.  The design also used the or gate on the multiple interrupts.  When I removed the or gate and ran the interupts directly into the PS interrupt and only left the aliases in my system-top.dts file the uart-lites started worked corectly. 

0 Kudos