Hi Alexandre,
Before answering all your questions I remembered about the JTAG module that also can send interrupts requests. Is it possible that this is the interrupt source ? Does it raises interrupts during the main loop program?
What do you mean by the "Altera interrupt handler is randomly called
with a mask value equal to 1"? Where and how do you capture this
information? How do you ensure that your custom PIO does not raise
interrupts?
I put a breakpoint in the Altera interrrupt handler and checked the mask value just before the corresponding ISR is called. I modified the VHDL code of our custom PIO so that the IRQ signal remains low : " irq <= '0' "
Could you post a screenshot of your main Qsys connection window? Have
you assigned unique interrupt IDs in Qsys using System > Assign
interrupt numbers, and re-assigned the memory addresses also after
adding your component? What are the corresponding macro values in the
BSP's system.h?
Unfortunately I don't have access to QSYS today, I can post a screenshot tomorow if needed. But the two IPs have a IRQ ID.
Have you added an interrupt sender interface in your component
definition in Qsys? Did you bind it to the Avalon slave interface as
discussed here: https://moodlearchive.epfl.ch/2020-2021/mod/forum/discuss.php?d=55741?
Yes
Have you defined your own interrupt service function in your C code, and
registered it using alt_ic_isr_register as described in https://www.intel.com/content/dam/altera-www/global/ja_JP/pdfs/literature/hb/nios2/n2sw_nii52006.pdf?
Yes, the only interrupt registered is the timer's one, which works fine. If I don't register it I still get interrupts from this unknown source. The interrupt actually occurs even before the fist line of our code is executed.
Best,
Isaac