Firstly, many thanks to the creator for implementing serial comms with a class in PHP. The concept suits my project very well.
I have a problem to which I'm sure there's a simple solution. Despite sending the same AT commands that my terminal program (minicom) does when it connects to the modem, phpSerial cannot talk to the modem unless the terminal program connects first.
I did not notice this initially, because I was monitoring the data exchange with minicom during the testing phase. When I stopped using minicom, my program stopped working, too.
I would be grateful of any advice. How can I get phpSerial to "capture" the port in the way that minicom does?
Dave Coles-Dobay - 2011-02-17 09:45:47 - In reply to message 2 from James Valentine
Many hours to find this fix but adding the post moserial stty -F .dev/ttyS0 arguments in a custom flow control mode did the trick.
For Noobs like me having problems with using this script after reboot...
1. Install and open Moserial it allows multibyte words instead of simple one character at a time on no flow control devices.
2. Use Moserial to get the serial port and the device attached talking.
3 while the device is still connected to Moserial open a shell and type stty -F /dev/ttyS0 or what ever serial port you are using.
4. Follow the instruction for adding a custom mode line to the script ignore any unconf bits but put in all the stuff preceded by the - sign.
Also for the hardware benders
Solder a diode cathode and a 2.2Kohm resistor to pin 2 on a DB9 connect pin 5 to the signal ground of the serial device you are scanning. Connect the diode anode and the other side of the resistor to the two serial pins to scan.
Try the settings in moserial until you can read the output.
Watch the two devices communicate back and forth until you can see the pattern of the communications.
Then you can easily write a script that tries a series of codes on a serial port and output the results to a text file.
This will allow you to find all sorts of undocumented features and capabilities of common products.
I now have a php driven robotic arm fully functional without documentation.
Philipp - 2014-05-18 06:26:07 - In reply to message 3 from Dave Coles-Dobay
Thanks for your inspiration, James!
In my case, trying to talk to a telephone modem, "-clocal" (used in the php-serial library) seems to be the evil one. Because, the modem obviously keeps DCD=false as long as there is no connection (carrier on the line) yet.
So, using "clocal" (without the minus) solves that problem by ignoring the missing DCD signal.
I also saw people using the stty parameter "raw" which feels somehow appropriate to me, avoiding going into detail with lots of exotic settings, but I have not tested everything yet...