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!