Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

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

Altera_Forum
Honored Contributor II
1,888 Views

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
Altera_Forum
Honored Contributor II
830 Views

Hi, 

 

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

 

Thanks
0 Kudos
Reply