AnsweredAssumed Answered

UART adding 0x0d with 0x0a in the datastream

Question asked by rrunmai on Nov 29, 2011
Latest reply on Dec 9, 2011 by illishar

Hi,

 

I am using UART1 to transmit file.  Whenever the UART finds a 0x0A in the datastream it adds 0x0D with it and transmitting.  How to configure the UART1 of BF526 to work on rawdata mode.

 

Here is the configuration we done on our code.  What am I missing??

 

int config_BFuart1()

{

    uart1_fd = open("/dev/ttyBF1",O_RDWR | O_NOCTTY | O_NDELAY);

    //uart1_fd = fopen("/dev/ttyBF1","r+b");

    if (uart1_fd == -1)

    {

        fprintf(stderr,"Unable to open UART 1 - %s\n",strerror(errno));

        return -1;

    }

 

    tcgetattr(uart1_fd, &cur_uart1_options);

    old_uart1_options = cur_uart1_options;

    new_uart1_options = cur_uart1_options;

 

    #ifdef BLOCKING_MODE

 

    /*In blocking mode,If no characters are available, the read call will block (wait) until characters come in or an interval

    timer expires, or an error occurs*/   

        fcntl(uart1_fd, F_SETFL, 0);// Blocking mode

    #else

 

    /*In Non-blocking mode,the read function will return 0 if no characters are available on the port*/   

 

         fcntl(uart1_fd, F_SETFL, FNDELAY);//Non-blocking mode

    #endif

 

     cfsetispeed(&new_uart1_options, B115200);

    cfsetospeed(&new_uart1_options, B115200);

     new_uart1_options.c_cflag |= (CLOCAL | CREAD);

    new_uart1_options.c_cflag &= ~CSTOPB;

     new_uart1_options.c_cflag &= ~CRTSCTS;

 

    new_uart1_options.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP |INLCR | IGNCR | ICRNL | IXON);

    new_uart1_options.c_oflag &= ~OPOST;

        new_uart1_options.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);

        new_uart1_options.c_cflag &= ~(CSIZE | PARENB);

        new_uart1_options.c_cflag |= CS8;

    new_uart1_options.c_oflag &= ~(OCRNL | ONLCR | ONLRET | ONOCR | OFILL | OLCUC);

 

     tcsetattr(uart1_fd, TCSAFLUSH, &new_uart1_options);

    //usleep(20000);

 

    return 1;

 

}

 

Thanks,

Unmai.

Outcomes