Serial communication on Leon3

Luca Germano lucagermano at hotmail.com
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 fernando-ruiz.com>
>To: "Luca Germano" <lucagermano at hotmail.com>,<rtems-users at rtems.com>
>Subject: RE: Serial communication on Leon3
>Date: Wed, 15 Mar 2006 19:50:03 +0100
>
>HI,
>
>  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.
>
>
>here
>http://www.rtems.com/cgi-bin/viewcvs.cgi/rtems/cpukit/libmisc/shell/shell.c?
>rev=1.14&content-type=text/vnd.viewcvs-markup
>
>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 &=
>~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
>     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
>attributes(%s)\n",devname);
>     };
>----------------------------------
>
>
>-----Mensaje original-----
>De: Luca Germano [mailto:lucagermano at hotmail.com]
>Enviado el: mercredi 15 mars 2006 18:11
>Para: rtems-users at rtems.com
>Asunto: Serial communication on Leon3
>
>
>Hi
>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?
>Thanks
>
>





More information about the users mailing list