Altera_Forum
Honored Contributor
16 years agoquestions about uarts
Hi all,
I'm starting a new development with NIOS II and I have some questions regarding UART usage. First of all, I will briefly explain my application: I need 4 UARTs on my system. One (UART_PC) is connected to a PC. The PC sends commands and expects answers from these commands. I also need 3 other UARTs: UART_MATRIZ, UART_VDSL and UART_ADSL. When UART_PC receives a command from PC, the application needs to analyze it. Depending on the command, it can take actions such as turn on a LED, or a relay, or simply transfer this command to one of the other three UARTS, that are connected to other equipment. When a response came from one of three UARTS (UART_MATRIZ the UART_VDSL and UART_ADSL) this should simply be transferred to the UART_PC. My question is: How do this in NIOS? The idea of using the STDIO functions such as fopen, fread, fwrite, etc is appealing but I am not sure if I can use then. The examples I saw on Altera documentation are quite simple and didn't help me so much. Can I open multiple files simultaneously? One for each UART? Do I need to do file polling using getc () to wait for anything other than EOF? How do I implement timeout for the messages coming from PC? Do I need to open files in a non-blocking mode? If yes, how do I do it?. Do I need to use interrupts to deal with these UARTS? How can I do it? I implemented something very similar on an atmel microcontroller, but I needed to write everything from scratch (interrupt routines, timeout, etc). Do I need to to that on NIOS? Thanks!!