And if you're OK with implementing your application in bash, you can use minicom or stty (to set baudrate, parity, stop bits, etc), and the standard shell tools cat and echo.

Subhash wrote:
Hi Peter,
Thanks for ur reply. Here some piece of code that i developed to make use of UART0, still i am facing problem in using uart at Baudrate 115200.Here i am attaching piece of code for ur reference. PLz review code and let me know any mistake. int OpenSerialPort ( PortNumber_t pnPortNumber, BaudRate_t bdBaudRate )
{
    int          ret;
    int     rReturnVal = 0;
    char serialDev[30] ;
   //here pnPortNumber is 1 means i try to open /dev/tts/0
    sprintf (serialDev,"/dev/tts/%d", pnPortNumber - 1 );

    if ( (fd = open(serialDev, O_RDWR)) < 0)
    {
        perror ("open failed");
        fprintf(stderr, "Opening of dev %s failed.\n", serialDev);
        rReturnVal = SERIAL_PORT_OPEN_FAILED;
        return (rReturnVal);
    }
    tcflush(fd, TCIFLUSH);
    ret = tcgetattr(fd, &save);
    if ( ret == -1)
    {
        perror("tcgetattr");
        rReturnVal = SERIAL_PORT_OPEN_FAILED;
        return (rReturnVal);
}
    Initialize_serial(fd, bdBaudRate);
}
int Initialize_serial(int fd, BaudRate_t bdBaudRate)
{
    struct termios  tmp;
    speed_t speed = B115200;
    if ( tcgetattr(fd, &tmp) == -1)
    {
        fprintf(stderr, "Getting terminal default settings failed !\n");
        return (-1);
    }
    switch (bdBaudRate)
    {
        case 9600:
            speed = B9600;
            break;
        case 57600:
            speed = B57600;
            break;
        case 115200:
            speed = B115200;
            break;
        case 921600:
                speed = B921600;
                  break;
        default:
                speed = B115200;
                 break;
    }

    tmp.c_iflag &= ~(IGNBRK | IXANY | IUCLC | INLCR | ICRNL | ISTRIP \
                   | IXON | BRKINT);^M

    tmp.c_oflag &= ~OPOST;
    tmp.c_cflag &= ~CSIZE;
    tmp.c_cflag |= CREAD;
    tmp.c_cflag |= CS8;
    tmp.c_lflag &= ~ (ICANON |ISIG | ECHO | IEXTEN);
    tmp.c_cc[VMIN] = 1;
    tmp.c_cc[VTIME] = 0;

    cfsetispeed(&tmp, speed);
    cfsetospeed(&tmp, speed);

    if (tcsetattr(fd, TCSANOW, &tmp)!= 0)
    {
        fprintf(stderr, "Setting terminal properties failed !\n");
    }
    return 0;
}
and i am reading uart data using read sys call( read(fd, buffer, (size_t) 1);) and writing data using write sys call write (fd, (char *)ucpDataBuffer, txSize);. During read operation I am not receiving proper data. Is there any UART settings need to be changed Please help me on this. Regards,
Subhash B Karigar

----- Original Message -----
From: "Peter Wippich" <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
To: "Subhash" <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
Cc: <[email protected] <mailto:[email protected]>>
Sent: Thursday, March 22, 2007 8:07 PM
Subject: Re: UART0 help

>
> man 2 open
> man 2 read
> man 2 write
> man termios
>
> ...........
>
> Can't  resist,
>
> Peter
>
> On Thu, 22 Mar 2007, Subhash wrote:
>
> > Hi All,
> >
> > I want to make use of UART0 in my application, is there a source code is available already? And also I want to know what is the maximum baudrate this uart supports... can we go higher baudrate like 921kbps?. PLease can any one help me on this...
> >
> > Regards,
> >
> > Subhash B Karigar
> >
>
>
> | Peter Wippich Voice: +49 30 46776411 | > | G&W Instruments GmbH fax: +49 30 46776419 | > | Gustav-Meyer-Allee 25, Geb. 12 Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> | > | D-13355 Berlin / Germany |
>
>
>
------------------------------------------------------------------------

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to