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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Stuck in Interrupt Handler

Altera_Forum
Honored Contributor II
2,194 Views

Hi all. 

 

I am fairly new to NIOS II development, although I have been working with Altera FPGA's for some time. I need to implement serial ports and have been fighting with the NIOS II UART IP for several days. I have finally determined that the Altera provided UART does not seem to have a proper interrupt handler or is not smart enough to keep from overwriting the TX buffer on the UART. The behavior is that any data sent from the NIOS II to the UART only arrives back in Hyperterminal if I put a usleep() call after writing each byte. If I don't, bytes get corrupted. 

 

So, I decided to switch to the FIFO'ed Avalon UART from this site. When I run my NIOS II code in the debugger, it never even hits the first breakpoint in my mian() routine. If I then pause execution, the processor is always looping either in the FIFOed UART's interrupt handler (fifoed_avalon_uart.c), or in the system source that checks for any active interrupts (alt_irq_handler.c). 

 

I am not using an OS - just straight up NIOS C/C++ code. Is this the problem? I've done a lot of embedded code over the years, and you should not need an OS to implement an IRQ handler, unless I don't understand something fundamental about how the NIOS works. 

 

Any advice is appreciated. I am running Quatus 9.0 sp1. Thanks! 

 

Jim
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
1,094 Views

As an update to my posting, I regenerated the SOPC again, recompiled and downloaded the FPGA design, then went back and rebuild the system library. Now I hit my first few breakpoints, but no serial data seems to go through the FIFO'ed UART, and any time I break the code is in the UART interrupt handler.... 

 

Jim 

0 Kudos
Altera_Forum
Honored Contributor II
1,094 Views

Hi Jim, 

 

Unfortunately a huge number of threads about UARTs from the last 2 years has been wiped from this forum along with everything else. As an embedded programmer you should be pleased to know that the NIOS UART can be handled exactly like the UARTs you know and love. I and many others use the standard UART extensively with no OS, no HAL drivers, just good old Receiver Full/Transmitter Empty interrupts. It should work exactly as you'd expect. 

 

Cheers 

 

Sharkybaba 

 

 

 

0 Kudos
Reply