- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using DSP 2S60 NIOSII with uCOS, try to connect to PC-COM with RS232.
At PC side, I want to use windows Hyper Terminal. I got a testing program from Fischer and modified it as bellow: # include <stdio.h># include <string.h># include <unistd.h># include <fcntl.h># include "system.h" int main (int argc, char* argv[]) { int res, rx_count = 0, i; unsigned char rx_buf[100], test[30]; int fd; //open handler if((fd = open(UART1_NAME, O_RDWR | O_NONBLOCK)) < 0) { printf("Can not open %s \n", UART1_NAME); return(0); } printf("Please input any words\n"); while(1) { res = read(fd, test, 25); if(res > 0) { for(i = 0; i < res; i ++) { if(test == '\r') {rx_buf[rx_count] = 0;
//print out one line
printf("rx:count:%d:<%s>\n", rx_count, rx_buf);
rx_count = 0;
} else
rx_buf[rx_count ++] = test; } } } } After running it on 2S60, I can see message "Please input any words" on IDE's console, or see it on the shell window if I use nios2-terminal. But never can read any word from PC side. If I open HyperTerminal, can not see any message output on it and 2S60 also can not read any word from it. Does any one can help me to fix it. Thank you very much. David
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I forget to explain the UART1_NAME:
In my system.h, it is defined as:# define UART1_NAME "/dev/uart1" and the BAUD is 115200 David
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page