Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21088 Discussions

Why doesn't main() work/run when I add a timer?

Rodo
New Contributor I
667 Views

HI all,

I'm playing with an old Bemicro kit (MAX10: 10M08DAF484C8GES) and I got it blinking an LED (D1). I now added a timer (timer_0) in platform designer, made the connections and compile. I get no errors. The kit has 8 LEDs and every time I make a change I change which LEDs come on so I know the hardware changes are working (they are). Then I go to the C program in eclipse,  re-generate the bsp. Added some code to register the isr and irq. Run the code and nothing happens. I have the software turn off all LEDs so I know it is working but the LEDs (set in hardware) never turn off. It doesn't look like main() is executing at all. I try to "Debug as" nios hardware and it looks like it is stuck in an interrupt but that may just be my guess. The code for the ISR (Interrupt Service Routine) only clears the flag for the timer irq. I wonder what I'm missing? Why doesn't main work?

Here are the pictures of the platform designer and timer. I could show the code for my project but since it never gets to main ...seems pointless. The interrupt number in the picture shows "0" (bottom right). I tried changing it to "5" but still same results. Any help is appreciated. Thanks

 

qsys1.jpgqsys timer.jpg

0 Kudos
5 Replies
EBERLAZARE_I_Intel
637 Views

Hi,


Based on your design, if you remove the interrupts, it seems that everything is working as expected, so you may want to check your design again when you added the interrupt. Regarding the usage of IRQ and ISR you may refer below for more details:


https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/nios2/n2sw_nii52006.pdf


https://www.intel.com/content/dam/altera-www/global/en_US/uploads/f/fb/AppendixD_Using_Interrupt_Service_Routines.pdf


0 Kudos
Kenny_Tan
Moderator
631 Views

Any further help is needed?


0 Kudos
EBERLAZARE_I_Intel
615 Views

Hi,,


Do you require further help?


0 Kudos
Rodo
New Contributor I
586 Views

@EBERLAZARE_I_Intel: 

I'm good. You may close this. Thanks.

0 Kudos
EBERLAZARE_I_Intel
566 Views

I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, feel free to open a new thread to get the support from Intel experts. Otherwise, the community users will continue to help you on this thread. Thank you.


0 Kudos
Reply