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!

Showing results for 
Search instead for 
Did you mean: 
Registered: ‎09-22-2015

Uartlite recv data failed in linux


 I am using uartlite IP in linux with vivado 2015.2.

 In order to test the uartlite I tied the uartlite TX port to its own RX port.

 The kernel can successfully probe the device ttyUL,but it seems  works abnormally.


 The process echo to the device ttyUL1 get nothing output.



 The send process in the linux application seems ok, but it blocks in the func "read" .

 The dts is like following:


	amba_pl: amba_pl {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "simple-bus";
		ranges ;
		axi_uartlite_0: serial@42c00000 {
			clock-names = "ref_clk";
			clocks = <&clkc 0>;
			compatible = "xlnx,xps-uartlite-1.00.a";
			current-speed = <115200>;
			device_type = "serial";
			interrupt-parent = <&intc>;
			interrupts = <0 29 1>;
			port-number = <1>;
			reg = <0x42c00000 0x10000>;
			xlnx,baudrate = <0x1c200>;
			xlnx,data-bits = <0x8>;
			xlnx,odd-parity = <0x0>;
			xlnx,s-axi-aclk-freq-hz-d = "50.0";
			xlnx,use-parity = <0x0>;


 The test application:

         if((w_fd = open("/dev/ttyUL1", O_RDWR )) == FALSE)
		printf("open error!");
		return -1;

	//char *string = "678091203456789123456789\r";
	char string[80] = {0x64,0x11,0x23,0x16,0x64,0x02,0xd5,0x02,0xd5,0x02,0xd5,0x0b,0x1a,0x11,0x85,0x16,0xD};
	if((lenth = write(w_fd, string, 17)) < 0)
		printf("send error!!\r\n");
	printf("send_data ok ,lenth = %d\r\n",lenth);
read_buffer_size = read(w_fd, read_buffer,READ_BUFFER_SIZE); if(read_buffer_size < 0 ) { printf("strerror:%s\n", strerror(errno)); return -1; } printf("read: %s,\n size: %d\n", read_buffer, read_buffer_size);

 Anyone have some ideas ? Thanks very much!






0 Kudos
2 Replies
Xilinx Employee
Xilinx Employee
Registered: ‎08-02-2007

Re: Uartlite recv data failed in linux



just as an initial debug can you confirm if you have the dts set as shown here and enabled the uart in kernel as documented here?




Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Scholar vanmierlo
Registered: ‎06-10-2008

Re: Uartlite recv data failed in linux

I'd start by checking that anything is actually transmitted. Attach your oscilloscope or if you don't have one, attach an LED with current limiting resistor between TxD and Vcc. Use a low baudrate and transmit lots of 0x00 to see the LED light up.


Then, what value is READ_BUFFER_SIZE? I'd start with just 1. You don't want read() to wait for more characters than you sent or than fit in the UARTlite buffer in this test case. To make sure you're not running into canonical mode problems, transmit a string with an end-of-line '\n'.

0 Kudos