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++
12611 Discussions

DSP 2S60 NIOSII with uCOS II, using RS232

Altera_Forum
Honored Contributor II
878 Views

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 == &#39;\r&#39;) { 

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&#39;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
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
227 Views

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
0 Kudos
Reply