Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
1,069 Views

Why I couldn't transmit data to UART using IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE,

Hi,  

 

I used the following code to access the UART (rs232 serial port) component I created in Qsys, I connected the txdata pin to the oscilloscope and it shows nothing, i am wondering why couldn't I use IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE, txdata); to transmit data to UART? 

What I want to do is Nios processor reads data from FPGA, Nios transmits the data to serial port and plot graph real time using Maltab,using de0 nano. I do not need to read data from serial port. 

 

#include "altera_avalon_uart_regs.h" 

 

#define UART_BASE 0x00002000 

 

 

int main (void) 

{alt_u16 status, rxdata=0,aa=0, txdata=0; 

while (! (status & 0x0040)) // Wait for transmission completion  

status = IORD_ALTERA_AVALON_UART_STATUS (UART_BASE);  

printf("status= %.2f V \r\n", (float) status); 

rxdata = 5; // assuming I get this data by accessing sdram in Nios 

txdata = rxdata; 

 

IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE, txdata); 

printf("txdata= %.2f V \r\n", (float) txdata); 

 

return 0;} 

 

 

Could you please give me some hints? Thanks
0 Kudos
1 Reply
Highlighted
Valued Contributor III
11 Views

Hi, 

 

I'm having the exact same problem. Could you tell me if you got past it? 

 

Thanks
0 Kudos