- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using the uart interrupt.
when data is received trough the uart the program jump to perform the interrupt the problem is that the interrupt flag of the uart stays on and so the interrupt is perform again and again and doesn't return? is the responsibility of clearing the interrupt is mine? how do I clear the interrupt ?Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are we talking SDK or HAL?
HAL: By default, the HAL ISRs should handle all of the IRQ clearing activity. SDK: I'm honestly not sure what is handled and what isn't. I'm sure others will be able to answer this one though. If you're not using Nios II, then the latter case would apply. Also, how do you know that the UART is the cause of your problem? Have you set a breakpoint in your ISR to see if that's where the failure is happening? Cheers, - slacker- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i'm talking on HAL
and i don't see that it clears the interrupt- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have set a breakpoint in the interrupt handler and so that it perform the handler routine.
and then goes to check if there are other pending interrupt and return to perform the uart interrupt's handler routine again and again- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using your own interrupt handler or the one from the HAL?
The HAL UART driver clears the interrupt in the function alt_avalon_uart_irq before processing it. But it is possible that if you're single stepping then the hardware will have interrupted again before you have stepped out of the interrupt routine. For example, if transmit interrupts are enabled then it will take a few ms to send the characters which have been queued up, but several tens of seconds for you to step out of the interrupt routine. One thing I notice when stepping through interrupt routines is that the timer interrupt is almost always set (since it takes more than 10ms for me to step a few times). I solve this by stepping out of alt_irq_handler using the step out button rather than one line at a time.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks wombat
I'm using my own interrupt handler. where can I find the hal's handler ? it is true that I get interrupted by the timer , but the problem is that the uart interrupt doesn't get clear and so it is called again and again- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok found the Hal's handler it is in
altera_avalon_uart.c- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you're using your own handler then you need to make sure the HALs one doesn't get installed as well. The easiest way to do this is to run your initialisation code from main, but make sure the first thing it does (before touching any registers etc) is to unregister the interrupt handler.
Another way to do it (if you aren't replacing the whole initialisation scheme) would be to copy the UART files into your system library project and edit them there to replace the HAL code with your own.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
don't call fscanf or fgets from with in the interrupt handler

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page