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.
Update: perhaps try the streamline method, but the above should work.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 "."; } }
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |