Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
2,740 Views

UART 16550 vs standard UART

Hi all, 

is there a simple way of replacing the standard UART, which is in all examples, with the UART16550? 

I mean, that simply all stdin/stdout/stderr goes to the UART16550? 

I can only have one UART in the system, and would remove then the standard UART ... 

Thanks!
0 Kudos
18 Replies
Altera_Forum
Honored Contributor I
237 Views

Hi all,  

just tried to get the 16550 UART to work at all, but no output so far. I tried to implement, what is in the the "ug_embedded_ip" manual, but so far no luck. 

Is there anything obvious missing, or wrong: 

 

# include <stdio.h> 

# include <stdlib.h> 

# include <sys/ioctl.h> 

# include <sys/termios.h> 

# include <fcntl.h> 

# include <string.h> 

# include <unistd.h> 

# include <sys/time.h> 

# include <time.h> 

# include "system.h" 

# include "altera_16550_uart.h" 

# include "altera_16550_uart_regs.h" 

 

# define BUFSIZE 512 

char TXMessage[BUFSIZE] = "Hello World, UART16550 sending\n"; 

 

int UARTDefaultConfig(UartConfig *Config) 

Config->stop_bit = STOPB_1; 

Config->parity_bit = NO_PARITY; 

Config->data_bit = CS_8; 

Config->baudrate = BR115200; 

Config->fifo_mode = 0; 

Config->hwfc = 0; 

Config->rx_fifo_level= RXFULL; 

Config->tx_fifo_level= TXEMPTY; 

return 0; 

int UARTBaudRateTest() 

UartConfig *UART0_Config = malloc(1*sizeof(UartConfig)); 

altera_16550_uart_state* uart_0; 

 

uart_0 = altera_16550_uart_open ("/dev/a_16550_uart_0"); 

UARTDefaultConfig(UART0_Config); 

altera_16550_uart_write(uart_0, &TXMessage, strlen(TXMessage), 0); 

usleep(1000); 

free(UART0_Config); 

return (0); 

 

int main() 

int result=0; 

result = UARTBaudRateTest(); 

 

Thanks!
Altera_Forum
Honored Contributor I
237 Views

Hi, 

 

What you mean by replacing the standard UART? 

How about changing the BSP settings (stdin, stdout, stderr) to 16550 UART? 

Are you trying to printf output through 16550 UART IP instead of RS232 UART IP?
Altera_Forum
Honored Contributor I
237 Views

I had a look at using the 16550 UART. In the end I found it much easier to use this one:- 

http://www.alterawiki.com/wiki/fifoed_avalon_uart 

 

It is exactly the same to use as the standard Altera UART but offers buffering, higher speed, RS485 driver enable + lots more. Well worth a look.
Altera_Forum
Honored Contributor I
237 Views

 

--- Quote Start ---  

Hi, 

 

What you mean by replacing the standard UART? 

 

--- Quote End ---  

 

 

yes! 

 

--- Quote Start ---  

How about changing the BSP settings (stdin, stdout, stderr) to 16550 UART? 

Are you trying to printf output through 16550 UART IP instead of RS232 UART IP? 

--- Quote End ---  

 

 

Exactly. I saw in another post, that you should be able to simply replace the "uart0" in the BSP_HAL editor, 

but in the setttings HAL/Common stdin/stdout/stderr, the only entry is "none" and the a_16550_uart_0 can't be selected. 

 

Do I have to rename the instance of "a_16550_uart_0" to "uart_0" in qsys? 

 

Thanks!
Altera_Forum
Honored Contributor I
237 Views

Hi, 

 

I suspect you observed "none" in the settings due to the Qsys generated files are not refreshed/synced with your SBT. 

Try reload the .sopcinfo file and create new BSP. You do not have to rename as the settings should reflect the name in Qsys.
Altera_Forum
Honored Contributor I
237 Views

 

--- Quote Start ---  

Hi, 

 

I suspect you observed "none" in the settings due to the Qsys generated files are not refreshed/synced with your SBT. 

Try reload the .sopcinfo file and create new BSP. You do not have to rename as the settings should reflect the name in Qsys. 

--- Quote End ---  

 

 

I tried that too, and the 16550_uart doesn't show :(
Altera_Forum
Honored Contributor I
237 Views

Did you export those UART signals in Qsys?

Altera_Forum
Honored Contributor I
237 Views

 

--- Quote Start ---  

Did you export those UART signals in Qsys? 

--- Quote End ---  

 

 

Yes, they also show up in the .bdf file and are connected there ...
Altera_Forum
Honored Contributor I
237 Views

Have you tried if JTAG UART works?

Altera_Forum
Honored Contributor I
237 Views

 

--- Quote Start ---  

Have you tried if JTAG UART works? 

--- Quote End ---  

 

 

No. I had the "standard" UART in before, got my application working, but needed one with a FIFO. So tried to get the 16550-UART to work, without success. 

What I'm really trying is to get the RSU working (application note 741), so my NIOS system is pretty simple, basically using the AN-741 template, and replacing 

the UART in it with the 16550-UART. Any chance anybody else can try it?
Altera_Forum
Honored Contributor I
237 Views

 

--- Quote Start ---  

No. I had the "standard" UART in before, got my application working, but needed one with a FIFO. So tried to get the 16550-UART to work, without success. 

What I'm really trying is to get the RSU working (application note 741), so my NIOS system is pretty simple, basically using the AN-741 template, and replacing 

the UART in it with the 16550-UART. Any chance anybody else can try it? 

--- Quote End ---  

 

 

And, all of this is done on MAX10, and the Altera DK-DEV-10M50 board...
Altera_Forum
Honored Contributor I
237 Views

Sorry that I am confused. For your working design, you must have seen the RS232 UART in BSP setting. But you are saying that you get "none". 

So which is correct?
Altera_Forum
Honored Contributor I
237 Views

 

--- Quote Start ---  

Sorry that I am confused. For your working design, you must have seen the RS232 UART in BSP setting. But you are saying that you get "none". 

So which is correct? 

--- Quote End ---  

 

 

No problem ;-) 

 

what I did: 

 

a.) used the RSU AN741 template, generated a NIOS system, with an UART, which was working, I could "see" the UART in the BSP-Editor. 

However, the performance for our application wasn't sufficient, so we tried to install the 16550-UART, which has big FIFOs, which we thought would 

improve the performance on the serial line. 

 

b.) We added the a_16550_uart to our QSYS design, but it doesn't show up in the BSP editor. Only the "standard" uart_0 is there. 

 

c.) we removed the standard uart_0 from the QSYS, and now there aren't any UART anymore to select in the BSP editor. 

 

So, what are we doing wrong, that the a_16550_uart doesn't show up in the BSP editor, as an UART for stdin/stdout/stderr? 

 

thanks!
Altera_Forum
Honored Contributor I
237 Views

I have tried to replicate your issue and observed the same behavior. 

Most likely this is due to the HAL driver for 16550 UART is not ready for such BSP configuration :(
Altera_Forum
Honored Contributor I
237 Views

 

--- Quote Start ---  

I have tried to replicate your issue and observed the same behavior. 

Most likely this is due to the HAL driver for 16550 UART is not ready for such BSP configuration :( 

--- Quote End ---  

 

 

Thanks a lot for trying! 

I was going nuts, as I thought I'm doing something wrong, and in other posts it sounded to easy ;-) 

 

Altera: any chance to fix this? 

 

Thanks again!
Altera_Forum
Honored Contributor I
237 Views

This issue has been logged. Let's look forward to the fix in near future :)

Altera_Forum
Honored Contributor I
237 Views

 

--- Quote Start ---  

This issue has been logged. Let's look forward to the fix in near future :) 

--- Quote End ---  

 

Excellent! 

Will there be a patch, 

or do we have to wait for 16.3 or 17.0? 

Thanks!
Altera_Forum
Honored Contributor I
237 Views

The delivery milestone is undecided at the moment.

Reply