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.

Can't open ttyS0 !!!

Altera_Forum
Honored Contributor II
1,154 Views

Hi All ! 

 

I used 2s60ES and build uclinux for my board . I wrote simple example relate with UART this is my code : 

 

struct termios options; 

fd=open("/dev/ttyS0",O_RDWR );  

if(fd==-1) 

printf("Cannot open ttyS0!!\n"); 

exit(0); 

}  

fcntl(fd,F_SETFL,0); 

 

tcgetattr(fd,&options);  

options.c_cflag |=(CLOCAL | CREAD); 

...... 

........ 

then I ran my example it CANNOT OPEN TTYS0 !!!! 

 

thanks for help !
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
475 Views

Did you enable nios uart driver in kernel config? 

If you already run console or shell on the uart, you can't open it again. use stdin/out instead. 

Otherwise, try "cp /etc/motd /dev/ttyS0" .
0 Kudos
Reply