Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12434 Discussions

UART RS232 receive missing bytes

Altera_Forum
Honored Contributor II
1,114 Views

Hi, 

 

I have trouble receive bytes of data using UART RS232 port on uClinux running NIOS2 /f. A loopback application was implemented to send 128 bytes hex data from ttyA0 (RS232 port) and receive on ttyA5 (RS232 port). This is a DE2-115 development kit. The IRQ for both port is 1 and 2. I have a JTAG for nios2-terminal, but it's irq is 3. I have disabled the flow control (ctsrts, xon/xoff,etc), but each loopback test I do, I always missing 10 to 11 bytes. However, if I send less than 10 bytes of data, I have higher chance of success getting the same bytes across. If anyone know of this problem and have a solution to it, please kindly let me know what I am missing? 

 

Thanks, 

 

Yeung
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
147 Views

Hi, I had also similar problem : missing bytes in UART. 

 

You are treating UART RS232 as interrupts, which are at high priorities. That is quite good. 

 

I don't know uClinux, I guess it employs Hardware Abstraction Layout functions. 

 

Others write their own drivers for RS232 

 

For me, I employ FIFOed UART (in opencores.org

 

Search in forum, many thread on that, but I haven't found perfect solution. 

 

Regards
Altera_Forum
Honored Contributor II
147 Views

I'd guess that the kernel has interrupts disabled (or a long interrupt routine) for long enough for you to lose bytes. 

The only real solution is to add a hardware rx fifo to the uart (or rx dma - but that is just a fifo in host memory). 

With a small OS (aka no real OS at all) you can probably ensure that the interrupt latency is always short enough. But I doubt you'll manage with anything large!
Altera_Forum
Honored Contributor II
147 Views

Hi, 

 

 

--- Quote Start ---  

 

I have experience missing receive bytes using UART RS232 port on uClinux running NIOS2 /f. I implemented a loopback application to send 128 bytes hex data from ttyA0 (RS232 port) and receive on ttyA5 (RS232 port). This is a DE2-115 development kit. The IRQ for both port is 1 and 2. I have a JTAG for nios2-terminal, but it's irq is 3. I have disabled the flow control (ctsrts, xon/xoff,etc), but each loopback test I do, I always missing 10 to 11 bytes. However, if I send less than 10 bytes of data, I have higher chance of success getting the same bytes across. I have heard I need a FIFO MEGAIP for the design but there no current uClinux driver support it. If you know of this problem and have a solution to it, please kindly let me know what I am missing? 

 

--- Quote End ---  

 

At first, please check whether the rx buffer overflow is happend really or not by e.g. 'cat /proc/tty/device/altera_uart' etc. If you want to use an UART IP with FIFO, please check the next page. 

 

http://alterawiki.com/wiki/fifoed_avalon_uart 

 

This IP has the same registers as the normal UART, and maybe we can use the same UART driver. I tested it under the next configuration and at least, it works. 

 

Kazu
Reply