how do disable carriage return character in UART-0 (FRDMK64)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how do disable carriage return character in UART-0 (FRDMK64)

Jump to solution
2,711 Views
sudhakarp
Contributor V

HI,

     I am using FRDMK64f120 controller, KDS2.0 and KSDK 1.1.0 example . when i transfer "0x0A" character through uart its adding automatically "0x0D" carriage return character. i dnt want carriage return character so how to remove that one.

regards,

sudhakar p

Labels (1)
0 Kudos
Reply
1 Solution
2,445 Views
sudhakarp
Contributor V

Hi david,

     finally i commented following c coding in "nio_tty.c" file.  now my problem solved

function: nio_tty_write

if ((fpc->flags & NIO_TTY_FLAGS_EOL_RN) && (*s == '\n'))

        {

            ret = _nio_write(devc->fd, "\r", 1);

            if (-1 == ret)

            {

                //TODO: errno should not be used in the low level driver. This is workaround for layering devices. _nio_write should not set errno, rather write should do it.

                return -errno;

            }

            if (0 == ret)

            {

                break;

            }

        }

Thank you DAVID.

regards,

sudhakar p

View solution in original post

0 Kudos
Reply
4 Replies
2,445 Views
DavidS
NXP Employee
NXP Employee

Hi Sudhakar,

I'm using KSDK_1.3 but should be same for you.

Look in ~C:\Freescale\KSDK_1.3.0\test_frdm-k64f_ksdk_mqx_pe_fp\SDK\rtos\mqx\mqx\source\bsp\init_bsp.c

In the _bsp_nio_stdio_install() function the stdin/stdout/stderr get setup.  You can remove the NIO_TTY_FLAGS_EOL_RN flag.

    close(1);

    fd = open("tty:", NIO_TTY_FLAGS_EOL_RN | NIO_TTY_FLAGS_ECHO);  // 1 - stdout

    assert(fd == 1);

Regards,

David

0 Kudos
Reply
2,446 Views
sudhakarp
Contributor V

Hi david,

     finally i commented following c coding in "nio_tty.c" file.  now my problem solved

function: nio_tty_write

if ((fpc->flags & NIO_TTY_FLAGS_EOL_RN) && (*s == '\n'))

        {

            ret = _nio_write(devc->fd, "\r", 1);

            if (-1 == ret)

            {

                //TODO: errno should not be used in the low level driver. This is workaround for layering devices. _nio_write should not set errno, rather write should do it.

                return -errno;

            }

            if (0 == ret)

            {

                break;

            }

        }

Thank you DAVID.

regards,

sudhakar p

0 Kudos
Reply
2,445 Views
sudhakarp
Contributor V

Hi David,

     give some idea to solve this problem.

regards,

sudhakar p

0 Kudos
Reply
2,445 Views
sudhakarp
Contributor V

hi,

still i am having problem. i did my code following way, and also i am using fwrite(data, 1, 1, ser_device); function to out character through uart.

ser_device = fopen(SERIAL_DEVICE, "w");

fwrite(data, 1, 1, ser_device); function to out character through uart.

fclose(ser_device);

  /* Install and open dummy drivers for stdin, stdou and stderr. */

   res = _nio_dev_install("dummy:",&nio_dummy_dev_fn, (NULL));

    assert(NULL != res);

    fd = open("dummy:", 0);  // 0 - stdin

    assert(fd == 0);

    fd = open("dummy:", 0);  // 1 - stdout

    assert(fd == 1);

    fd = open("dummy:", 0);  // 2 - stderr

    assert(fd == 2);

    /* Instal and set tty driver */

    res = _nio_dev_install("tty:", &nio_tty_dev_fn, (void*)&(NIO_TTY_INIT_DATA_STRUCT){BSP_DEFAULT_IO_CHANNEL, 0});

    assert(NULL != res);

   close(0);  

    fd = open("tty:",NIO_TTY_FLAGS_ECHO);  // 0 - stdin

    assert(fd == 0);

    close(1);

    fd = open("tty:",NIO_TTY_FLAGS_ECHO);  // 1 - stdout

    assert(fd == 1);

    close(2);

    fd = open("tty:",NIO_TTY_FLAGS_ECHO);  // 2 - stderr

    assert(fd == 2);

AND ALSO I TRIED:

close(0);  

    fd = open("tty:",0);  // 0 - stdin

    assert(fd == 0);

    close(1);

    fd = open("tty:",0);  // 1 - stdout

    assert(fd == 1);

    close(2);

    fd = open("tty:",0);  // 2 - stderr

    assert(fd == 2);

but still its outing carriage return character. this implementation i am doing in ethernet_to_serial example. give some idea.

regards,

sudhakar p

0 Kudos
Reply