Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12435 Discussions

Serial connection for DE2 is not working

Altera_Forum
Honored Contributor II
834 Views

When I look in the manual it says that serial connection should work but when I try to run the program it is not working and not even code formatting in the Nios 2 IDE works. 

 

/* A simple program that recognizes the characters 't' and 'v' */# include <stdio.h># include <string.h> int main () { char* msg = "Detected the character 't'.\n"; FILE* fp; char prompt = 0; fp =fopen("/dev/uart1", "r+"); //Open file for reading and writing if (fp) { while (prompt != 'v') { // Loop until we receive a 'v'. prompt = getc(fp); // Get a character from the JTAG UART. if (prompt == 't') { // Print a message if character is 't'. fwrite (msg, strlen (msg), 1, fp); } if (ferror(fp))// Check if an error occurred with the file pointer clearerr(fp);// If so, clear it. } fprintf(fp, "Closing the JTAG UART file handle.\n"); fclose (fp); } return 0; }  

 

Chapter 6 in the Embedded Peripherals IP... says that this code should work but it doesn't.
0 Kudos
0 Replies
Reply