Forum Discussion
Altera_Forum
Honored Contributor
9 years agoUART interrupt with HAL
Hello I read a lot of threads about interrupts and UART and good resolution was this (http://www.alteraforum.com/forum/showthread.php?t=17224) but I'm looking something without write own driver. I...
Altera_Forum
Honored Contributor
9 years ago --- Quote Start --- From the software side of things, have you checked system.h from your BSP? --- Quote End --- Yes, I checked system.h and everything is ok:
#define UART0_IRQ 3
# define UART0_IRQ_INTERRUPT_CONTROLLER_ID 0 --- Quote Start --- ALSO, in your isr register function you're telling it to use the 'isr_timer_0' callback rather than the defined 'isr_uart0' callback. --- Quote End --- I cut my code to prepare minimal example and it was copy-paste error ;) in my code I have proper callback. I investigated this and I have problem as follows: int main()
{
alt_ic_isr_register(UART0_IRQ_INTERRUPT_CONTROLLER_ID, UART0_IRQ, isr_uart0, my_context, 0x0);
alt_printf("Hello from main");
while(1);
}
void isr_uart0(void* context)
{
alt_printf("Hello from isr");
} When printf from main is executed program go to isr_uart0 callback and go to alt_irq_handler from alt_irq_handler.c and there is endless loop and nothing is printed to uart. For first printf: alt_putchar is called -> then in alt_putchar code for direct drivers is executed and alt_driver_write() calls altera_avalon_uart_write(). Last point of this chain is isr_irq_handler which calls my callback in endless loop with no output to terminal. I just want to get chars from terminal in isr but i think without using registers it is impossible.