Reception with serial port ttyS0 second part.

Xiangfu Liu xiangfu at sharism.cc
Fri Apr 23 23:14:11 EDT 2010


Hi Jose

I have test your code in my Nanonote. it works fine.

when you Press KEY_S while poweron. the serial console will
output one line like:
  "[S] Pressed enable UART"

make sure you have this line from serial console when boot.
the boot serial bandrate is 57600.

Best Regards
xiangfu

On 04/23/2010 10:22 PM, Jose Luis Cabra Lopez wrote:
> Hi everybody
> Well, my transmition, namely my TXD is OK, this sourcecode is in my nano and
> works perfectly. But my RXD don't works. I don't know what happen? My
> sourcecode of reception in my PC works perfectly, but in my nanonote it
> doesn't work.
>
> I have read the last message and I've pushed in the same time the keys
> 'POWER' and 'S' while my nanonote is poweron and still it don't work.
>
> Some suggestions?
>
> One more time
> thanks a lot Xiangfu Liu.
>
> This is my sourcecode
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> // Librerias
> #include<sys/types.h>
> #include<sys/stat.h>
> #include<fcntl.h>
> #include<termios.h>
> #include<stdio.h>
> #include<stdlib.h>  // Ayuda a los exit
> #include<sys/ioctl.h>
> #include<string.h>  // Para que sira bzero
>
> // Define generales de configuración
> #define  BAUDRATE B9600
> #define  MODEMDEVICE "/dev/ttyS0"
> #define  _POSIX_SOURCE 1 /* POSIX compliant source */
> #define  FALSE 0
> #define  TRUE 1
> volatile int STOP=FALSE;
>
> // Programa Principal
> int main()
> {
>    int fd, c, res;
>    struct termios oldtio,newtio;
>    char buf[255];
> // Abriendo el puerto serial con file descriptor
>    fd = open(MODEMDEVICE, O_RDWR/*O_RDONLY*/ | O_NOCTTY);
>    if (fd<0) {perror(MODEMDEVICE); exit(1); }
> // Configuración del puerto
>    tcgetattr(fd,&oldtio); /* save current port settings */
>    bzero(&newtio, sizeof(newtio));
>    newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
>    newtio.c_iflag = IGNPAR;
>    newtio.c_oflag = 0;
>    /* set input mode (non-canonical, no echo,...) */
>    newtio.c_lflag = 0;
>    newtio.c_cc[VTIME]     = 0;   /* inter-character timer unused */
>    newtio.c_cc[VMIN]      = 5;   /* blocking read until 5 chars received */
>    tcflush(fd, TCIFLUSH);
>    tcsetattr(fd,TCSANOW,&newtio);
> // ciclo de recepción.
>    while (STOP==FALSE) {       /* loop for input */
>      res = read(fd,buf,255);   /* returns after 5 chars have been input */
>      buf[res]=0;               /* so we can printf... */
>      printf(":%s:%d\n", buf, res);
>      if (buf[0]=='z') STOP=TRUE;
>    }
>    tcsetattr(fd,TCSANOW,&oldtio);
> }
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
>
>
>
> _______________________________________________
> Qi Developer Mailing List
> Mail to list (members only): developer at lists.qi-hardware.com
> Subscribe or Unsubscribe: http://en.qi-hardware.com/mailman/listinfo/developer





More information about the discussion mailing list


interactive