Forum Discussion
Altera_Forum
Honored Contributor
15 years agoI can give you my functions I used to test the Uart. Maybe these can help you to find the problem.
void init_uart(int BAUD) { int divi; divi = (100000000 / BAUD) + 0.5; IOWR_16DIRECT(RS232_INST_BASE, 0x14, divi); } void write_uart(char x) { unsigned long status = 0; while((status & 0x00000040) != 0x00000040) { status = IORD_ALTERA_AVALON_UART_STATUS(RS232_INST_BASE); } IOWR_ALTERA_AVALON_UART_TXDATA(RS232_INST_BASE, x); } char read_uart(void) { char x; x = IORD_ALTERA_AVALON_UART_RXDATA(RS232_INST_BASE); return x; }