[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with serial port




Hi

I hope someone can help me, excuse me if my english is not perfect.

I have done a server running on the dev_board lissening on a socket and the 
seriel port 1 (ttyS0). The problem is that I can't make the dev_board sending 
data over the serial interface. The strange thing is that the same code is 
working on the PC without any problem.

To try solving the problem I made two test application, one server lissening 
on the serial port and one sending. When I start the server on the dev_board 
and the sender on the PC it works, but the reversed do not. 

I init the port with:

        serial = open("/dev/ttyS0", O_RDWR | O_NOCTTY );
        if (serial <0)
        {
                fprintf(stderr, "No, the port /dev/ttyS0 is NOT open ");
                exit(-1);
        }
        else
        {
                fprintf(stderr, "/dev/ttyS0 open with fd = %d\n", serial);
        }
   
        bzero(&newtio, sizeof(newtio));
        newtio.c_cflag = B38400 | CRTSCTS | CS8 | CLOCAL | CREAD;
        newtio.c_iflag = IGNPAR;
        newtio.c_oflag = 0;
        newtio.c_lflag = 0;
        newtio.c_cc[VTIME] = 0;
        newtio.c_cc[VMIN] = 0;
        tcflush(serial, TCIFLUSH);
        tcsetattr(serial,TCSANOW,&newtio);

Again. The PC can send with this settings but not the dev_board.

One smaller question. Is it worth uppgrading to the new relese (R 2.0.0)? It 
allready works perfecly (except serial) and I don't plan to use the new 
opptions glibc provide. 

Thank's
Per-Ola Svensson, t98pos@xxxxxxx.se