Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12622 Discussions

Serial connection for DE2 is not working

Honored Contributor II

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