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

alt_irq_register can't work

Altera_Forum
Honored Contributor II
1,269 Views

I have added a component CAN controller into SOPC builder, and it work well. I can send and receive data correctly. But i can't register the interrupt(IRQ) send out from the controller. I checked anything i know.... 

 

Here is my code, it can be compiled and no errors, but just die in the alt_irq_register function. Anybody have experience to use CAN controller in  

SOPC builder can tell me where is the problem?  

 

 

 

static void handle_CAN2_interrupts(void* context, alt_u32 id) 

int q; 

q =IORD(CAN2_BASE, 0x4);  

printf(" interupt = %d \n",q);  

 

 

int main() 

printf("Hello from Nios II!\n"); 

 

 

alt_irq_register(CAN2_IRQ,NULL, handle_CAN2_interrupts ); 

 

tx_basic_frame(); 

 

 

i use quartus 8.0 and NIOS ii 7.2 to do this
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
453 Views

also i test to use the timer interrupt, and it worked fine. i can't figure why me controller can't even register irq...

0 Kudos
Altera_Forum
Honored Contributor II
453 Views

I don't know your CAN controller, but I guess you probably need to clear the irq inside the handler function, otherwise the irq would continuously retrigger just after you have serviced it.

0 Kudos
Altera_Forum
Honored Contributor II
453 Views

 

--- Quote Start ---  

I don't know your CAN controller, but I guess you probably need to clear the irq inside the handler function, otherwise the irq would continuously retrigger just after you have serviced it. 

--- Quote End ---  

 

 

 

Thanks for your advise, i find my controller send a unexpected interrupt after reset, and it cause the retrigger problem you said.
0 Kudos
Reply