in reply to How to send long sting Device::SerialPort

Is this OMAP uart? Ordinary PC serial ports are ttySxx (for Linux at least).

Looking at Device::SerialPort, I see it makes a promise to handle I/O in a stream-like manner for the tied filehandles. The write method is just POSIX::write underneath, so the same concerns apply as with syswrite ie. loop and check the return value.

With a tied handle, a simple print FH $string; ought to do.

  • Comment on Re: How to send long sting Device::SerialPort

Replies are listed 'Best First'.
Re^2: How to send long sting Device::SerialPort
by rkrasowski (Sexton) on Dec 08, 2013 at 13:36 UTC

    Yes, this is BeagleBoneBlack, so OMAP UART, that's what that is. I will try today to add wrapper to devide string into 15 bytes pieces and see if that will work the way that I expect. Second part is to send stream of data via Device::SerialPort. Will se how that one will go. I will keep you updated. Thanks for help. Robert

      Supposedly, the OMAP has 6 UARTS, each with two 64 byte buffers, one for TX, one for RX. http://www.ti.com/lit/ug/spruh73i/spruh73i.pdf, page 3984, in the diagram.

        Well, I make some modifications into my script and now it is working. I use method with Tied FileHandles and that seems to have no problem with long strings. Below is the script. Next step will be to send continious string of data from one serial port to the different one. I will keep you posted. Robert

        #!/usr/bin/perl use strict; use warnings; use Device::SerialPort; my $PORT = "/dev/ttyO1"; my $Config = "serial.cfg"; my $string = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"; my $ob = Device::SerialPort->new($PORT) || die "Can't Open $PORT: $!"; $ob->baudrate(115200) || die "failed setting baudrate"; $ob->parity("none") || die "failed setting parity"; $ob->databits(8) || die "failed setting databits"; $ob->handshake("none") || die "failed setting handshake"; $ob->write_settings || die "no settings"; $| = 1; $ob->write_settings; $ob->save("serial.cfg"); $ob = tie (*FH, 'Device::SerialPort', $Config) || die "Can't tie: $!\n"; ## TIEHANDLE ## print FH $string; close FH || warn "close failed"; undef $ob;