Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
878 Views

alt_irq_register can't work

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 I
62 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...

Altera_Forum
Honored Contributor I
62 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.

Altera_Forum
Honored Contributor I
62 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.
Reply