Forum Discussion

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

fwrite and UART RXData

Hello,

I need some help.

My Matlab code is as follows:

fopen(s);

fwrite(s,127,'int8');

A=fscanf(s,'%i');

B=fscanf(s,'%i');

B=fscanf(s,'%i');

fwrite(s,127,'int8');

fclose(s);

However, when I try to perform a printf from Nios2, all I recieved was the the value from the first fwrite(...).

The data from the second fwrite(...) seems to be missing.

Why this is so?

Thanks.

1 Reply

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

    Hi, with only those elements, hard to help you.

    To be clear :

    { PC -------------to, via serial interface (RS232...),----------------> your NIOS II board }

    Here you posted the Matlab "program" that sends data from your PC.

    { your NIOS II board ---------- to, via JTAG--------------> your PC or another PC }

    Your NIOS II receive data and you use "printf" to print, via JTAG, to your Nios II terminal

    Right ?

    How does your NIOS II program look like ?

    With NIOS II, You use interrupts or simply read RS232 time to time ?