Forum Discussion

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

Read from UART

Good morning!

I´m a NIOSII starter and trying to get first results.

My question: Why can´t i read anything from the UART? I can write to it, but i don´t receive anything or i receive and don´t recognize it.

I´m working with WIN2000, a DSP 1S25-Board, Quartus II 4.2, NIOSII 1.1.

Because of tutorials i suppose that "normal" C should work with NIOSII (this is a fragment of the SW-Tutorial for writing to the UART and it works:

// fp = fopen ("/dev/uart1", "w");

// if (fp)

// {

// fprintf(fp, "%s",msg);

// }

// fclose (fp);

Now i want to read from it:

// TRY TO READ FROM UART1

// input = NULL;

// input = fopen ("/dev/uart1", "r+");

// if (input)

// {

// printf("%c",fgetc(input));

// }

// fclose(input);

// input = NULL;

But there is no reaction http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif !?

I am thankful for any ideas and please respect my beginner-status...

Nice day! Max

11 Replies

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

    I got it down to just these three:

    # include <fcntl.h># include <stdio.h># include <unistd.h>

    for the uart at least.