Hi. I was hoping for a recognizable known fault. I trust that I provide the additional data with a comment (like this) to the Issue trail.

I can establish the correctness on the USB unit (OBD2 LM327) connected to COM5 with RealTerm SW (on Laptop Win 10 system). I did have some screen dumps to demonstrate this. But I am unsure if this is possible with this interface. These RealTerm dumps do demonstrate connection of 38,400 baud and 8N1. Also transmitting the command "ati\n" (\n carriage return) gives a response of "ELM327 v1.5 carriage return". Note I have ensured the echoing is off ("ate0\n"), prior to this. This USB unit's operation copies modem AT commands.

The next part of this involves running the same COM5 port setup with not RealTerm but with Perl. The manipulation of the configuration can be achieved with a program like (and the response just below it) ;

#! perl -w use strict; use Win32::SerialPort; my $ob = Win32::SerialPort->new ('COM5') || die; my $baud = $ob->baudrate; my $parity = $ob->parity; my $data = $ob->databits; my $stop = $ob->stopbits; my $hshake = $ob->handshake; print "B = $baud, D = $data, S = $stop, P = $parity, H = $hshake\n"; my @data_opt = $ob->databits; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } @data_opt = $ob->stopbits; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } @data_opt = $ob->handshake; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } @data_opt = $ob->parity; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } @data_opt = $ob->baudrate; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } undef $ob; ======================= Response ================== B = 38400, D = 8, S = 1, P = none, H = none Data Bit Options: 7 8 Data Bit Options: 2 1 Data Bit Options: rts none dtr xoff Data Bit Options: odd space even none mark Data Bit Options: 300 115200 57600 19200 1200 4800 9600 38400 2400 60 +0

I seem to have no issues with the manupilation of the configuration of COM5.

However, if I cross to a write then read program, coping the above RealTerm success of outputting "ati\n", I get no success. The code used and the response is;

#! C:\perl\bin\perl.exe use strict; use warnings; use Win32::SerialPort; my $port_name = 'COM5'; my $config_file = 'setup.cfg'; my $port = new Win32::SerialPort($port_name, $config_file) || die "Una +ble to open: $^E\n"; # my $status = pack('HHHHHH', 'ca', '00', '01', '00', '00', 'fe'); $port->write("ati"."\n"); sleep 0; my $debug = 1; while(1) { my $line = $port->lookfor(); if( $line ) { { local $/ = "\r"; chomp $line; } if ($debug) { print "[$line]" ;} # Some data processing takes place } else { sleep(1); # Allocate time for other processes to run print "."; } } ======================= Response ================== .......

As you can see from the above I get to the endless loop without any information presented.

My IDE is Eclipse.

Regards JC......


In reply to Re: Win32::SerialPort on Win10 issue by jmClifford
in thread Win32::SerialPort on Win10 issue by jmClifford

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.