February 15, 2017 at 8:31 pm #55254
Hello! I have added UART16550 core support to https://github.com/MIPSfpga/mipsfpga-plus project.
• Terasic DE10-Lite;
• support of other boards can be added easily.
• all uart specific code was imported from https://github.com/olofk/uart16550 and https://github.com/freecores/uart16550 projects;
• all imported uart core code was placed in folder uart16550;
• Module mfp_ahb_lite_uart16550 is always turned on. The behavior of its inputs and outputs depends on MFP_USE_DUPLEX_UART option that was placed in mfp_ahb_lite_matrix_config.vh;
• UART_RX is always connected to uart program loader (mfp_uart_receiver);
• UART_TX is connected to mfp_ahb_lite_uart16550 TX output when MFP_USE_DUPLEX_UART is undefined and disconnected in other case;
• UART_SRX и UART_STX signals of mfp_system are connected mfp_ahb_lite_uart16550 only when MFP_USE_DUPLEX_UART is defined;
• modem signals of mfp_ahb_lite_uart16550 (UART_RTS, UART_CTS, UART_DTR, UART_DSR, UART_RI, UART_DCD) are available in module interface (inside the mfp_ahb_lite_matrix) but was not mapped on mfp_system level;
• uart module interrupt signal (UART_INT) is available but was not connected to SI_Int;
• UART_STX is connected to UART_SRX in simulation mode;
• all code is simulated with modelsim and tested on Terasic DE10-Lite board;
• 05_uart program added – it sends ‘Hello!’ to uart after reset, outputs all received chars to LED and 7-segment indicator and sends all chars back to PC. Its working mode is: 8n1, 115200
• there is a separate sandbox, where I have developed this uart module: https://github.com/zhelnio/ahb_lite_uart16550. It can be used for standalone simulation debug;
• uart core doc was placed in https://github.com/zhelnio/ahb_lite_uart16550/tree/master/doc
05_uart program run order
• turn on (uncomment) MFP_USE_DUPLEX_UART option in mfp_ahb_lite_matrix_config.vh;
• Select running mode in main.c
For SIMULATION mode
• compile the program and run it in simulator:
• the program will send ‘Hello’ string to uart. These chars will be send and received by module because UART_STX and UART_SRX are connected in simulation mode. All received char codes will be shown on LED and 7-segmen indicator;
For HARDWARE mode
• check the connection of uart signals UART_SRX and UART_STX to the GPIO port of the top module (boards/de10_lite/de10_lite.v for example)
• connect the usb-uart converter to PC and the GPIO port of the board (UART_STX и UART_SRX);
• build the rtl code and program the board;
• run the terminal program on PC and connect it to the COM port (mode: 8n1, 115200) that is relevant to UART_SRX и UART_STX signals.
• build the software and upload it to the board:
• press reset button on the board;
• the ‘Hello’ string will be shown in the terminal window;
• the code of each received symbol will be shown on LED and 7-segmen indicator;
• each received symbol will be transmitted back to PC.