Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21615 Discussions

fwrite and UART RXData

Altera_Forum
Honored Contributor II
1,546 Views

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.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
671 Views

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 ?
0 Kudos
Reply