Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 19 Sep 2007 01:58 PM by  richh@logicpd.com
Uart0 - Hardware flow control pins RTS/CTS problems
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages
s.bencke@terra.com.br
New Member
New Member
Posts:


--
06 Jul 2007 12:37 PM
    Hi,
    I'm using Kernel 2.6.19.2 and Litekit 1006581 REV2. I'm tring to use the debug port to communicate with a serial device (RS485). Fist I configured my bootloader to use the ttymxc2 as a console port and let the ttymxc0 free for my use (I can acess Linux by Telnet).
    In my Linux program I open the Ttymxc0 and I can write and read the serial port without problems, but I neet to use the hardware control pins RTS/CTS and this pins are not working.

    I try to configure the serial port to use Hardware Flow control and I try to use de "ioctl" function and neither of them works !!!


    Here is a part of my code:

    //********************************************************************************************
    //***************** Here I open the TTYMXC0 *****************************************
    //********************************************************************************************
    TtyUbus = open( "/dev/ttymxc0", O_RDWR | O_NONBLOCK | O_NDELAY | O_NOCTTY);// Open the tty
    if (TtyUbus == -1){
    printf( "Error, unable to open port\n" );
    return -1;
    }
    tcgetattr( TtyUbus, &termOptions );
    cfsetispeed( &termOptions, B19200 );
    cfsetospeed( &termOptions, B19200 );
    termOptions.c_oflag |= (BRKINT | IGNPAR); //( testar IXANY)
    termOptions.c_oflag &= ~(OPOST | OLCUC | ONLCR | OCRNL | ONOCR | ONLRET | OFILL | OFDEL | NLDLY |CRDLY | TABDLY | BSDLY| VTDLY| FFDLY);
    termOptions.c_iflag |= (BRKINT | IGNPAR);
    termOptions.c_iflag &= ~(IGNBRK | INPCK | ISTRIP | INLCR | IGNCR | ICRNL | IUCLC | IXON | IXANY | IXOFF |IMAXBEL);
    termOptions.c_cflag |= ( CLOCAL|CREAD );
    termOptions.c_cflag |= PARENB;
    termOptions.c_cflag &= ~CSTOPB;
    termOptions.c_cflag &= ~CSIZE;
    termOptions.c_cflag |= CS8;
    //termOptions.c_cflag |= CRTSCTS;
    termOptions.c_cflag &= ~CRTSCTS;
    termOptions.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
    // Set the new options for the port
    tcsetattr(TtyUbus, TCSANOW, &termOptions);



    //********************************************************************************************
    //***************** In this other part, I just change the state of RTS *************************
    //********************************************************************************************
    While(1)
    {
    ioctl(TtyUbus, TIOCMGET, &flags );

    flags &= ~TIOCM_RTS;
    flags &= ~TIOCM_DTR;
    ioctl(TtyUbus,TIOCMSET,&flags);
    Lost_some_time();

    flags |= TIOCM_RTS;
    flags |= TIOCM_DTR;
    ioctl(TtyUbus,TIOCMSET,&flags);
    Lost_some_time();
    write(TtyUbus,"Test Uart\r\n",11);
    }

    Somebody knows if there is a hartdware problem with this pins or if I'm making something wrong?

    Thanks,
    SB
    richh@logicpd.com
    New Member
    New Member
    Posts:52


    --
    19 Sep 2007 01:58 PM
    SB,
    Please see my post on Sept. 17th about UART problems.
    You are not authorized to post a reply.