Showing results for 
Search instead for 
Did you mean: 
Honored Contributor I

UART ISR and fprintf

Hello, I am fairly new to writing ISRs and handling interrupts for the Nios processor.  


Here is a brief intro to what I'm trying to do and what is already working: 


I have created my own ISR in order to receive data from another device connected by UART. I would like to be able to write to that device as well. So far, if I enable interrupts and register my handler, I can no longer use fprintf or fwrite to send data back to that device. I would like to be able to nonetheless...what can I do?  


My ISR: 

volatile int uart_capture; void uart_handle(void *context){ unsigned short int data,status; volatile int* uart_ptr = (volatile int*) context; status = IORD_ALTERA_AVALON_UART_STATUS(BLUETOOTH_BASE); while (!(status & ALTERA_AVALON_UART_STATUS_RRDY_MSK)) status = IORD_ALTERA_AVALON_UART_STATUS(BLUETOOTH_BASE); data = IORD_ALTERA_AVALON_UART_RXDATA(BLUETOOTH_BASE); *uart_ptr = IORD_ALTERA_AVALON_UART_RXDATA(BLUETOOTH_BASE); IOWR_ALTERA_AVALON_UART_STATUS(BLUETOOTH_BASE, 0x0); IORD_ALTERA_AVALON_UART_RXDATA(BLUETOOTH_BASE); }
0 Kudos
0 Replies