Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

UART RS232 receive missing bytes

Altera_Forum
Honored Contributor II
1,703 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
736 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
0 Kudos
Altera_Forum
Honored Contributor II
736 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!
0 Kudos
Altera_Forum
Honored Contributor II
736 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
0 Kudos
Reply