Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Unplanned NIOS2 RESTART !

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 ?

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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 ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.