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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

some queations about UART

Altera_Forum
Honored Contributor II
979 Views

[quote]

Hello!

 

When I use De2 board ,add a UART IP core in my cpu,I want to use a peripheral equipment connects to the serial port of De2. 

First ,I use the serial port of De2 connectted to PC,I found there no problem,it can receive and send data. But when I use the serial port of De2 connectted to the peripheral equipment ,I can open the UART of DE2,but it can't receive the data from the peripheral equipment ,what's the problem? thank you!

 

(the peripheral equipment is scan equipment,it can connect with the De2 using a serial port .)

 

ps:

[CODE] 

the code in Nios IDE is here:

 

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include "system.h"

int main()

{int i=0;

 

int length=500;

char reply[500];

char c;

FILE *fp;

fp=fopen("/dev/uart_0","r+");

 

while(1)

{if (fp)

{printf("\nOpen Sucessfully!\n");

printf("\nReady to receive!\n");

fgets(reply,500,fp);

printf("haha\n");

for(i=0;i<length;i++)

{printf("%c",reply[i]);

}

}

}

fclose(fp);

return 0;

}

 

and stdout set is jtag_uart

stdin set is uart_0

stderr set is jtag_uart

0 Kudos
0 Replies
Reply