Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

UART ISR and fprintf

Altera_Forum
Honored Contributor II
799 Views

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
Reply