Looks like you are well on the way. Yes, Win32:SerialPort should work fine for this application.

I would print the configuration to make sure you know what it is. 38400 8N1 is common for these types of devices - looks plausible. You can just put explicit <CR> <LF> characters into the write string to prevent any ambiguities with "what does \n mean?". A single <CR> character should be enough for the modem to recognize end of command. But, you could try some permutations. Power on/off box between trials (make sure its brain is starting from zero). I would wait 1 second for ATI command to be sent before trying to read the response - the answer should be waiting when you get there.

It could be that your IDE is affecting things somehow. Try running your test program from the command line.

my $baud = $port->baudrate; my $parity = $port->parity; my $data = $port->databits; my $stop = $port->stopbits; my $hshake = $port->handshake; print "B = $baud, D = $data, S = $stop, P = $parity, H = $hshake\n"; $port->write("ati\x0D"); #keep simple for now single <CR> #also try \x0D\x0A <CR><LF> #try ATI\x0D (AT spec says upper case) sleep 1; #should allow for whole string to be sent #reply should be waiting #not clear how much buffering #goal is get a character, any character at first while(1) { my $line = $port->lookfor(); #can be multi-character response if( $line ) { print "[$line]"; # Some data processing takes place } else { sleep(1); # Allocate time for other processes to run print "."; } }
Update: perhaps try the streamline method, but the above should work.

update2: I think I understand what you have now. A USB gizmo that has 16 pin connector to the car on the other side. You don't actually have a serial cable so, serial cable breakout box won't help. However, Wireshark freeware for Windows can capture USB traffic CaptureSetup/USB. I would setup with your terminal emulator and capture USB traffic and then do the same with the Perl program.


In reply to Re^2: Win32::SerialPort on Win10 issue by Marshall
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.