Forum Discussion
Altera_Forum
Honored Contributor
9 years agoUART 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!18 Replies
- Altera_Forum
Honored Contributor
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
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 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
--- 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
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
--- 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
Did you export those UART signals in Qsys?
- Altera_Forum
Honored Contributor
--- 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
Have you tried if JTAG UART works?
- Altera_Forum
Honored Contributor
--- 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?