Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
We don't bite newbies here... much
 
PerlMonks  

Re: Losing bytes with Device::SerialPort ?

by zentara (Archbishop)
on Dec 21, 2005 at 12:07 UTC ( #518292=note: print w/ replies, xml ) Need Help??


in reply to Losing bytes with Device::SerialPort ?

You didn't show your code, but since it's the first character which gets corrupted, it reminded of another serial-port example I have, in which the author claimed you need to change the CR to a newline.

$ob = Device::SerialPort->new($PORT) || die "Can't Open $PORT: $!"; $ob->baudrate(9600) || die "failed setting baudrate"; $ob->parity("none") || die "failed setting parity"; $ob->databits(8) || die "failed setting databits"; $ob->stty_icrnl(1) || die "failed setting convert cr to new line"; $ob->handshake("none") || die "failed setting handshake"; $ob->write_settings || die "no settings";

I'm not really a human, but I play one on earth. flash japh


Comment on Re: Losing bytes with Device::SerialPort ?
Download Code
Re^2: Losing bytes with Device::SerialPort ?
by Anonymous Monk on Dec 21, 2005 at 20:50 UTC
    Hi,

    thanks for the tip, but unfortunately it doesn't help. Any other idea ? Why do I loose first byte - I start recevieing right away...

    Exposing more code :

    $port = '/dev/ttyS0'; $ob = Device::SerialPort->new ($port); $ob->user_msg(1); # misc. warnings $ob->error_msg(1); # hardware and data errors $ob->baudrate(19200); $ob->parity("none"); $ob->databits(8); $ob->stopbits(1); $ob->handshake('none'); $ob->stty_icrnl(1) || die "failed setting convert cr to new line"; $ob->read_interval(0) if ($OS_win); $ob->read_const_time(10000); #$ob->read_const_time(500); # 500 milliseconds = 0.5 seconds $ob->read_char_time(1); # avg time between read char $ob->write_settings || die "no settings";


    Is buffering enabled by default ?

    Thanks in advance,

    regards,

    Rob.
      I'm not able to test serial stuff, so I'm making wild guesses. :-) It sure sounds like a setting is off somewhere, here is another example How can I log a record with Ctrl-C as EOL from a serial port?

      Have you had sucess using some other method, like trying to cat the /dev/ttyS0 ? Or can you capture good data any other way?


      I'm not really a human, but I play one on earth. flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://518292]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (16)
As of 2014-04-17 13:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (448 votes), past polls