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++

Unplanned NIOS2 RESTART !

Altera_Forum
Honored Contributor II
1,295 Views

Hello All  

 

I have a big project with time critical devices - VGA and Sound playing  

 

VGA Refresh use separate video banks in separate SDRAMs  

 

I use DMA for VGA refresh - irq 9 most important  

And Sound player (fifo - almost_empty sygnal generate IRQ ) - irq 8  

 

I set IRQ handler to Sound Player and all work ( Video & sound correct) 

 

BUT SOME TIMES NIOS2 RESTART PROGRAMM in a random way!!!  

 

What reason will restart program ?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
263 Views

Here is IRQ handler  

 

And i find what string is influent to unplaned RESTART  

 

I mark in comments my try's and effects wich i get  

 

(1) - I try set IRQ wich can interrupt sound IRQ  

Result - NO EFFECT (SOUND WORK but VIDEO crash refresh) 

 

(2) - I try set manual enable VGA_IRQ  

Result - NO EFFECT (SOUND WORK but VIDEO crash refresh) 

 

(3) - I try to enable ALL Interupts inside Sound_irq  

Result - I get workable Sound and Video - ALL work's fine but sometimes nios restart programm by random way.  

 

void __irq_sound_handler(void* context,alt_u32 id) 

{  

if((dsp_buff[0] & FIFO_A_EMPTY) && playing) 

// alt_u32 old_priority=alt_irq_interruptible(VGA_DMA_IRQ); // (1). 

// alt_irq_enable_all(NIOS2_STATUS_PIE_MSK); //(3) 

// alt_irq_enable(VGA_DMA_IRQ); (2) 

 

FillSndBuff(); // fill sound fifo  

counter++; // counter of irq calls  

dsp_buff[1]=1; // IRQ ENABLE FLAG  

// Enable sound IRQ for next call (by default it IRQ ENABLE cleared when i sound fifo get chipselect) 

// IRQ is asserted when FIFO buffer signal almost_empty get rising edge  

 

// alt_irq_non_interruptible(old_priority); //(1).  

 

So I want create interuptable IRQ handler 

What I do wrong ? 

Any Ideas ?
0 Kudos
Altera_Forum
Honored Contributor II
263 Views

I find that most processor resets (on NIOS or other) are due to buffer overflows. I mostly happens when you overflow a buffer (i.e. go beyond the buffer space and into some other space ... either code or data) and then do something else. It is when doing something else that you usually see the problem, however the error actually occured when the buffer was overflown.

0 Kudos
Reply