- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[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
Link Copied

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page