Serial communication on Leon3

Luca Germano lucagermano at
Thu Mar 16 08:05:52 UTC 2006

Thanks for your help but if you read the reply to my post of 15 Mar 2006 
11:13:42 with Subject: Re: UART setting on Leon3, Jiri Gaisler said that 
ther is no termios interface to set the UART on Leon3 bsp. I think the 
procedure that you sent me is not applicable on Leon3 without termios 
support. Is it rigth?
See you.

>From: "Fernando RUIZ" <correo at>
>To: "Luca Germano" <lucagermano at>,<rtems-users at>
>Subject: RE: Serial communication on Leon3
>Date: Wed, 15 Mar 2006 19:50:03 +0100
>  You can close stdin,stdout,stderr and reopen like /dev/null.
>With this your serial device will be free for your private use.
>You need reopen the serial device /dev/ttyS1 (or similar name)
>in raw mode.
>Consult the shell.c source to known the setup procedure.
>Use man linux to show all the options.
>In shell.c the input device can be any character device (serial, socket
>tcp/ip, ...)
>and the characters are read one by one.
>See you.
>You have availiable a raw stream.
>    setvbuf(stdin,NULL,_IONBF,0); /* Not buffered*/
>    /* make a raw terminal,Linux MANuals */
>    if (tcgetattr (fileno(stdin), &term)>=0) {
>     term.c_iflag &=
>     term.c_oflag &= ~OPOST;
>     term.c_oflag |= (OPOST|ONLCR); /* But with cr+nl on
>output */
>     term.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
>     term.c_cflag  = CLOCAL | CREAD |(shell_env->tcflag);
>     term.c_cc[VMIN]  = 1;
>     term.c_cc[VTIME] = 0;
>     if (tcsetattr (fileno(stdin), TCSADRAIN, &term) < 0) {
>       fprintf(stderr,"shell:cannot set terminal
>     };
>-----Mensaje original-----
>De: Luca Germano [mailto:lucagermano at]
>Enviado el: mercredi 15 mars 2006 18:11
>Para: rtems-users at
>Asunto: Serial communication on Leon3
>I must handle a serial communication between Leon3 and a Linux Pc.
>Rtems mapps the stdio on UART. I have a lot of problems to read byte
>from serial port on Leon3 with the standard C function like getc or
>scanf. Have someone handled a serial communication on Leon3 UART?

More information about the users mailing list