Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1174 Discussions

DE1 Basic Computer on Nios II SBT

Altera_Forum
Honored Contributor II
1,438 Views

Hi everyone! I am a beginner with the Cyclone II board. Just got it last week. I tried to implement the DE1 Basic Computer project with the Altera Monitor Program and it works absolutely fine I wanted to implement the same with the Nios II SBT for Eclipse. The project builds and runs but only the Reset button, Red LEDs and the corresponding switches work. The 7 Segment Display and the Green LEDs do not work. On debugging I find that the "8 Second Timer" is never incremented. Is there something wrong with the interrupt and exception handling? Any suggestions?

0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
699 Views

Maybe you have to set a start bit on the timer register

0 Kudos
Altera_Forum
Honored Contributor II
699 Views

I have no idea what that means! Is there like something that I can read? 

If it works with the monitor program, why does it not work with the SBT?
0 Kudos
Altera_Forum
Honored Contributor II
699 Views

Take a look at the Interval Timer Core Docs at the following link page 251. 

 

When you look at the registers there's the START and STOP bits, my guess is that you have to write the start bit, this way the timer will increment. 

 

http://www.altera.com/literature/ug/ug_embedded_ip.pdf
0 Kudos
Altera_Forum
Honored Contributor II
699 Views

Cool. So this means I need to add the Interval Timer core through Qsys, without which the timers in the code won't work?

0 Kudos
Altera_Forum
Honored Contributor II
699 Views

Well, if the code compiles you might have 2 things to look at: 

 

1. You don't have the code for the timer, and so you don't have the Interval Timer Core in Qsys 

 

2. You have both but the interrupt is not working properly. 

 

Maybe I got what you want to do, you want to increment a seconds variable with the timer interrupt?
0 Kudos
Altera_Forum
Honored Contributor II
699 Views

Yeah! I have both. The interval timer core is there and I also have a working code for the timer (I know this because it works absolutely fine with the Monitor Program). 

The interrupt I believe is not working properly. It never hits breakpoints inside the interrupt block when I debug. 

So how do I get this interrupt to work?
0 Kudos
Altera_Forum
Honored Contributor II
699 Views

MrPsyclus...Do you know what I should look into for the interrupts to work??

0 Kudos
Altera_Forum
Honored Contributor II
699 Views

I think you can use this, change the defines for the ones you have on your system.h 

 

alt_ic_isr_register(SYS_TIMER_IRQ_INTERRUPT_CONTROLLER_ID,SYS_TIMER_IRQ,ms_clock_isr, NULL, 0x0); 

alt_ic_irq_enable(SYS_TIMER_IRQ_INTERRUPT_CONTROLLER_ID,SYS_TIMER_IRQ); 

 

ms_clock_isr is the function that treat the interrupt. 

 

Don't forget you have to clean the interrupt flag when you finish.
0 Kudos
Reply