Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

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

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

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

    Thanks