communitcation with serial port - VxWorks

This is a discussion on communitcation with serial port - VxWorks ; I'm beginner of Vxworks.I want to know how to access the data through serial port.i am using VxWorks 5.5. #include "stdio.h" #include "ioLib.h" #include "taskLib.h" #include "stdio.h" int test() { int fd; char Strbuff[]="hello,world"; fd=open("/tyCo/0",O_RDWR,0); if(fd==ERROR) { printf("Error in open()tty!"); ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: communitcation with serial port

  1. communitcation with serial port

    I'm beginner of Vxworks.I want to know how to access the data through
    serial port.i am using VxWorks 5.5.


    #include "stdio.h"
    #include "ioLib.h"
    #include "taskLib.h"
    #include "stdio.h"


    int test()
    {
    int fd;
    char Strbuff[]="hello,world";

    fd=open("/tyCo/0",O_RDWR,0);
    if(fd==ERROR)
    {
    printf("Error in open()tty!");
    return 0;
    }

    ioctl(fd,FIOSETOPTIONS,OPT_RAW);
    ioctl(fd,FIOBAUDRATE,9600);
    for(;
    {
    write(fd,Strbuff,sizeof(Strbuff));
    taskDelay(60);
    }
    close(fd);
    printf("String has been sent");
    return 0;

    }
    the programme above is about communication with serial port,but when I
    make it run,there is not any data appearing in my computer!
    when I check the situation of the running progamme ,it shows like
    below:



    i
    NAME ENTRY TID PRI STATUS PC SP
    ERRNO DELAY
    ---------- ------------ -------- --- ---------- -------- --------
    ------- -----
    tExcTask excTask 3fd3dc0 0 PEND 395063 3fd3d08
    0 0
    tLogTask logTask 3fd1420 0 PEND 395063 3fd1358
    0 0
    tWdbTask wdbTask 3f708fc 3 READY 31883b 3f707f0
    0 0
    t1 funcCallWrap 3f6f6d8 4 DELAY 390b91 3f6f610
    0 24
    tNetTask netTask 3f930fc 50 READY 3187a1 3f92f50
    0 0
    value = 0 = 0x0
    -> tw t1
    NAME ENTRY TID STATUS DELAY OBJ_TYPE OBJ_ID
    OBJ_NAME
    ---------- ---------- -------- ---------- ----- ---------- --------
    ------------
    t1 funcCallWr 3f6f6d8 DELAY 11 0

    value = 0 = 0x0
    -> ti t1
    NAME ENTRY TID PRI STATUS PC SP
    ERRNO DELAY
    ---------- ------------ -------- --- ---------- -------- --------
    ------- -----
    t1 funcCallWrap 3f6f6d8 4 DELAY 390b91 3f6f610
    0 13

    stack: base 0x3f6f6d8 end 0x3f6a6d8 size 19932 high 992 margin
    18940

    options: 0x1d
    VX_SUPERVISOR_MODE VX_DEALLOC_STACK VX_FP_TASK VX_STDIO

    VxWorks Events
    --------------
    Events Pended on : Not Pended
    Received Events : 0x0
    Options : N/A

    edi = 0 esi = 3c ebp = 3f6f628 esp =
    3f6f610
    ebx = 3f6f6d8 edx = 0 ecx = 0 eax =
    0
    eflags = 246 pc = 390b91


    I want to know what is wrong?


  2. Re: communitcation with serial port

    Hi:

    Did you do a "devs" to see what serial devices exist. If you didn't
    get the error from the open, it should be working if /tyCo/0 exists.

    I tried it and it does work. I did take over the shell when I spawned
    it.

    LC

    PS:Add a newline to your printf.

    devs
    drv name
    0 /null
    1 /tyCo/0
    2 /aioPipe
    5 bos0ws-lepus:
    6 /export/space/export
    6 /export/orion/release
    6 /export/orion/builds
    7 /pty/rlogin.S
    8 /pty/rlogin.M
    9 /vio
    10 /tgtsvr
    value = 25 = 0x19
    Orion DY4[cpu0]->lkup "test"
    routestatShow 0x003ee8b0 text
    testNameList 0x004f8924 data
    pthread_testcancel 0x00456b14 text
    test 0x00332578 text
    value = 0 = 0x0
    xxx[cpu0]->sp test
    task spawned: id = 0xf50efb0, name = t1
    value = 256962480 = 0xf50efb0
    xxx[cpu0]->hello,world


  3. Re: communitcation with serial port

    Do you mean strlen() rather than sizeof()?

    Always check the value returned from write. It returns the number of bytes
    written.

    If it returns ERROR check errno for an error code.

    --


    Regards,


    Graham Baxter
    Freelance Software Engineer (VxWorks, Linux and pSOS BSPs)
    Graham Baxter (Software) Limited
    http://www.gbsw.co.uk
    fromnewsgrp@NOSPAMgbsw.co.uk

    wrote in message
    news:1144666448.113224.144660@j33g2000cwa.googlegr oups.com...
    > I'm beginner of Vxworks.I want to know how to access the data through
    > serial port.i am using VxWorks 5.5.
    >
    >
    > #include "stdio.h"
    > #include "ioLib.h"
    > #include "taskLib.h"
    > #include "stdio.h"
    >
    >
    > int test()
    > {
    > int fd;
    > char Strbuff[]="hello,world";
    >
    > fd=open("/tyCo/0",O_RDWR,0);
    > if(fd==ERROR)
    > {
    > printf("Error in open()tty!");
    > return 0;
    > }
    >
    > ioctl(fd,FIOSETOPTIONS,OPT_RAW);
    > ioctl(fd,FIOBAUDRATE,9600);
    > for(;
    > {
    > write(fd,Strbuff,sizeof(Strbuff));
    > taskDelay(60);
    > }
    > close(fd);
    > printf("String has been sent");
    > return 0;
    >
    > }
    > the programme above is about communication with serial port,but when I
    > make it run,there is not any data appearing in my computer!
    > when I check the situation of the running progamme ,it shows like
    > below:
    >
    >
    >
    > i
    > NAME ENTRY TID PRI STATUS PC SP
    > ERRNO DELAY
    > ---------- ------------ -------- --- ---------- -------- --------
    > ------- -----
    > tExcTask excTask 3fd3dc0 0 PEND 395063 3fd3d08
    > 0 0
    > tLogTask logTask 3fd1420 0 PEND 395063 3fd1358
    > 0 0
    > tWdbTask wdbTask 3f708fc 3 READY 31883b 3f707f0
    > 0 0
    > t1 funcCallWrap 3f6f6d8 4 DELAY 390b91 3f6f610
    > 0 24
    > tNetTask netTask 3f930fc 50 READY 3187a1 3f92f50
    > 0 0
    > value = 0 = 0x0
    > -> tw t1
    > NAME ENTRY TID STATUS DELAY OBJ_TYPE OBJ_ID
    > OBJ_NAME
    > ---------- ---------- -------- ---------- ----- ---------- --------
    > ------------
    > t1 funcCallWr 3f6f6d8 DELAY 11 0
    >
    > value = 0 = 0x0
    > -> ti t1
    > NAME ENTRY TID PRI STATUS PC SP
    > ERRNO DELAY
    > ---------- ------------ -------- --- ---------- -------- --------
    > ------- -----
    > t1 funcCallWrap 3f6f6d8 4 DELAY 390b91 3f6f610
    > 0 13
    >
    > stack: base 0x3f6f6d8 end 0x3f6a6d8 size 19932 high 992 margin
    > 18940
    >
    > options: 0x1d
    > VX_SUPERVISOR_MODE VX_DEALLOC_STACK VX_FP_TASK VX_STDIO
    >
    > VxWorks Events
    > --------------
    > Events Pended on : Not Pended
    > Received Events : 0x0
    > Options : N/A
    >
    > edi = 0 esi = 3c ebp = 3f6f628 esp =
    > 3f6f610
    > ebx = 3f6f6d8 edx = 0 ecx = 0 eax =
    > 0
    > eflags = 246 pc = 390b91
    >
    >
    > I want to know what is wrong?
    >




  4. Re: communitcation with serial port

    thank you for helping me ,but i still have something not to
    understand,what does "funcCallWrap" mean? And,why does it always delay
    or pend?


+ Reply to Thread