VxWorks Serial port Loopback - VxWorks

This is a discussion on VxWorks Serial port Loopback - VxWorks ; Hi Guys ..Need Some Help.. I am trying to write a loopback code to test the serial port on MPC860.... So after opening the port I have spawned another task for read .... I am able to write the data...Checked ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: VxWorks Serial port Loopback

  1. VxWorks Serial port Loopback

    Hi Guys ..Need Some Help..

    I am trying to write a loopback code to test the serial port on
    MPC860....
    So after opening the port I have spawned another task for read ....
    I am able to write the data...Checked it on Hyperterm.....
    (Shorting TX--Rx) But while reading back the data .....Most of the
    times it does not and if it does read...it reads 7F ...which is the
    ASCII DEL....And very few times it actually reads the constant
    string.....transmitted.....Guys help out...ASAP...

    ****main code...
    ConsoleFd = open ((const char*)ucConsoleName, O_RDWR, 0);
    taskSpawn("craft_read",100,0,20000,(FUNCPTR)f_craftport_read,0,0,0,0,0,0 ,0,0,0,0);

    temp=write(ConsoleFd,(char*)data,3);//Abhijit 31 Jan 06
    printf("\n\tNumber of bytes written =%d",temp);

    taskDelay(10);


    ****f_craftport_read.....The spawned task..
    read(ConsoleFd,(char*)charRead,3);

    temp=read(ConsoleFd,(char*)charRead,3);//Abhijit 31 Jan 06
    printf("\n\tNumber of bytes read=%d\n",temp);

    printf("%s\n",charRead);//Abhijit 1 Feb 06

    if(!strcmp((const char*)charRead,(const char*)data))
    {
    printf("Serialport loopback poll test succesfull\n");

    }
    else
    {
    printf("report error\n");
    }

    */
    close(ConsoleFd);//Abhijit 1 Feb 0


    Abhijit


  2. Re: VxWorks Serial port Loopback

    Hi, Abhijit,

    Have you set your console (via ConsoleFd) to raw mode ?

    Try the following:
    (void)ioctl(ConsoleFd,FIOSETOPTIONS,OPT_RAW) ;

    HTH,
    Akiva


  3. Re: VxWorks Serial port Loopback

    Hi akiva..

    Thank u for suggestion...Found the bug...there was another FD open for
    the serial port...

    Abhijit


  4. Re: VxWorks Serial port Loopback

    Hey guys, I'm in need of major help.

    I'm trying to setup a simple loopback test on Redhat and it says writes to the ttyS0 port are fine, but it never reads back from it. I've tried your code, my code, and other simple code that I found online .... none of them have been able to read. I know it's writing for sure because I hooked it up to an oscilloscope. Should I try a reboot and changing settings? That's all I can think of because I don't know what's wrong.

    Any help would be greatly appreciated
    Thanks

+ Reply to Thread