sending of txt msg & h/w flow control in bs2p?? ensuring bs2p "talk" to modem??
nuradila
Posts: 18
hi..
how to make sure that the modem REALLY communicate with the BS2p? is it through SERIN/SEROUT?
i've tried mike cook's suggestion, that i shld tie the DTR to 5v, set modem's flow control to off and to save that settings in the modem, but it doesnt·seem to·work.below's the revised codes.
another qn: how to write·just a·simple program in BS2P such that it can send a text message/SMS to a mobile phone?
the BS2p is linked to a·wavecom gsm modem. i've tried this·alot of times (the program's below), and yet the program doesnt work. why it doesn't work and is flow control needed in this case?
just wanna ask if we can actually set hardware·flow control in bs2p. how to go abt doing that?
can explain more abt flow control?·· ·
·DEBUG "ATE1"
· DEBUG CR
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]···· ' to test flow control
·
'flow ctrl
· DEBUG "AT+IFC"
· DEBUG 61
· DEBUG "0,0"· '0,0 for flow ctrl off
· DEBUG CR
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
·
'AT+CSCA="98540020"[noparse][[/noparse]ENTER] -for smsc
· DEBUG "AT+CSCA"
· DEBUG 61
· DEBUG 34················ 'ASCII Equivalent for "
· DEBUG "98540020"············· 'smsc no defined - starhub
· DEBUG 34
· DEBUG CR
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
·
'Making sure that the GSM module is in text mode.
· DEBUG "AT+CMGF=1"
· DEBUG CR···················· ' Carraige Return ot 'Enter'
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
·
'AT+CGMS=91918287[noparse][[/noparse]ENTER]
· DEBUG "AT+CMGS"
· DEBUG 61······················ 'ASCII Equivalent for =
· DEBUG "91918287"··········· 'dest mobile no
· DEBUG CR
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
·
'>MSG^Z
· DEBUG "Testin frm bs2p"· 'msg
· DEBUG 26
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
END
RX_Error:
· DEBUG "Modem Error",CR,LF
· STOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
Post Edited (nuradila) : 8/11/2004 2:57:04 PM GMT
how to make sure that the modem REALLY communicate with the BS2p? is it through SERIN/SEROUT?
i've tried mike cook's suggestion, that i shld tie the DTR to 5v, set modem's flow control to off and to save that settings in the modem, but it doesnt·seem to·work.below's the revised codes.
another qn: how to write·just a·simple program in BS2P such that it can send a text message/SMS to a mobile phone?
the BS2p is linked to a·wavecom gsm modem. i've tried this·alot of times (the program's below), and yet the program doesnt work. why it doesn't work and is flow control needed in this case?
just wanna ask if we can actually set hardware·flow control in bs2p. how to go abt doing that?
can explain more abt flow control?·· ·
·DEBUG "ATE1"
· DEBUG CR
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]···· ' to test flow control
·
'flow ctrl
· DEBUG "AT+IFC"
· DEBUG 61
· DEBUG "0,0"· '0,0 for flow ctrl off
· DEBUG CR
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
·
'AT+CSCA="98540020"[noparse][[/noparse]ENTER] -for smsc
· DEBUG "AT+CSCA"
· DEBUG 61
· DEBUG 34················ 'ASCII Equivalent for "
· DEBUG "98540020"············· 'smsc no defined - starhub
· DEBUG 34
· DEBUG CR
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
·
'Making sure that the GSM module is in text mode.
· DEBUG "AT+CMGF=1"
· DEBUG CR···················· ' Carraige Return ot 'Enter'
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
·
'AT+CGMS=91918287[noparse][[/noparse]ENTER]
· DEBUG "AT+CMGS"
· DEBUG 61······················ 'ASCII Equivalent for =
· DEBUG "91918287"··········· 'dest mobile no
· DEBUG CR
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
·
'>MSG^Z
· DEBUG "Testin frm bs2p"· 'msg
· DEBUG 26
· PAUSE 5000
· SERIN RX\CTS, Baud, 50, RX_Error, [noparse][[/noparse]WAIT ("OK")]
END
RX_Error:
· DEBUG "Modem Error",CR,LF
· STOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
Post Edited (nuradila) : 8/11/2004 2:57:04 PM GMT
Comments
· SERIN Spin\FCpin, baud, [noparse][[/noparse]InputData]
The help file has complete details. If you want to "talk" to a PC using flow control, take a look at this article:
· http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv89.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Mike
Post Edited (Mike Cook) : 7/28/2004 7:54:41 PM GMT
Hope this helps,
Mike
I've attached the program file (GSMmodemtest.txt), but I can't get it to work correctly. The phone seems to be getting stuck in text mode, even though the escape character has been sent. The second file, output.txt, is what is actually going to the phone (I watched the output using Hyperterminal), looks ok to me, but I don't get any text!
If anyone can see the problem I'd be grateful for suggestions.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
If I sent these commands to the phone using hyperterminal, it works fine, which is confuses me!
Thanks anyhow.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
try this:
Connect your modem to your PC using a three wire cable, RX, TX, and GROUND only. Then from hyperterm try to communicate with the modem, if you can talk to the modem then try to send the SMS again from hyperterm. Remember when connecting your modem to your PC use the following table:
Modem Pin Out:·DB9·············PC's·RS-232 DB9
PIN 1 DCD (OUTPUT)
PIN 2 TX (OUTPUT)·············· PIN 2 RX (INPUT)
PIN 3 RX (INPUT)················· PIN 3 TX (OUTPUT)
PIN 4 DTR (OUTPUT)
PIN 5 GROUND···················· PIN 5 GROUND
PIN 6 DSR (OUTPUT)
PIN 7 RTS (INPUT)
PIN 8 CTS (OUTPUT)
PIN 9 RING (OUTPUT)
What we're trying to determine here is the minimum number of connections needed between the PC and the modem to successfully send a SMS, once this is determined then we'll address connecting the GSM/GPRS modem to the stamp.
Post Edited (Mike Cook) : 8/4/2004 2:52:16 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
Did you use a three wire cable between the modem and the PC or just a standard 9 wire cable to do this test?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
Don't use the Debug/Programming port of the stamp, this can be used to print debug statements to find out what's not working.
Pick another pin on the stamp to do your serial out statements to the modem. If you have a computer with two serial ports this will make this step easier.
Write a program for the stamp to output the modem commands, don't worry about the serial in for right now or the flow control stuff. After you download this to the stamp, connect the pin that you used on the stamp, for serial output to the modem, and connect it to PIN 2 of your other serial port on your PC. Open Hyperterm on that port and set the baud rate. When you reset the stamp you should see the commands that the stamp is outputting to Hyperterm. If your AT Commands show up in the hyperterm window then your ready for the next step. other wise you've got some debugging to do. As a standard I always use carriage return and Line feed with at Commands, something like this:
SEROUT ModemTx, Baud, [noparse][[/noparse]"AT", CR, LF]
If the Hyperterm test worked out ok then make sure your modem is set for the correct baud rate that the stamp is sending at, If the modem "auto bauds" don't rely on this, on most GSM/GPRS modems to set the baud rate you will use the AT+IPR command, once this is issued most modems will immediately change baud rate. You will need to reconfigure Hyperterm to the new baud rate, make sure you can talk to the modem and then save the new baud rate using AT&W. As a double check power cycle the modem and make sure that it comes up at the programmed baud rate.
Now with hyperterm still open at the baud rate that the stamp and the modem are communicating at, connect the modems PIN 2 on it's RS-232 connector to PIN 2 of the serial port of the PC. you will need to connect PIN 5 of the modem to PIN 5 of the PC's serial port also. Now on the stamp make sure that you connect a ground to PIN 5 of the modem's serial port and connect the pin that you are using on the stamp for serial output to the modem's PIN 3 of its serial port. Now hit reset on the stamp.
When the stamp resets it will send the AT Commands to the modem and the modems responses will show up on your PC's hyperterm window. Using this technique you can monitor what is actually happening and adjust the stamp's programming to output the correct commands for the modem to send an SMS. After you can successfully send a SMS message this way then you can use the Stamps serial in statement to check for the modem's responses and do some action on whether you get an "OK" or "ERROR".
As a side note I would use some debug statements so you can determine where in the code the stamp is while it's running.
i understand that i shld use SEROUT instead of DEBUG to send out the AT commands. sorry but i dont understand the connection portion as follows:
"connect the pin that you used on the stamp, for serial output to the modem, and connect it to PIN 2 of your other serial port on your PC. Open Hyperterm on that port and set the baud rate. When you reset the stamp you should see the commands that the stamp is outputting to Hyperterm."
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
By feeding the stamp's serial output line into a hyperterm session, using PIN 2 of the PC's serial port, you will see the AT commands that the stamp is sending. This way you will be able to see if they are being sent correctly and at the baud rate that you are expecting.
Is this wirring correct ?
PC1 = stamp editor PC
PC2 = hyperterminal PC
GSM = GSM modem
PC1-RX
BS2SX-SOUT
PC1-TX
BS2SX-SIN
(using standard programming cable)
PC2-RX
BS2SX-PIN0
|
GSM-RX--
PC2-TX
BS2SX-PIN1
|
GSM-TX--
Can the modem simply be connected directly to e.g. pin 0 and pin 1 ??
Regards
Anders
There are 2 tests I was trying to get nuradila to perform:
1. Determine if the Stamp was outputting the correct AT commands to a test device, in this case the test device would be Hyperterm configured for Serial Port 2.
2. Use the Stamp to output AT Commands to the modem and watch the modem's responses in Hyperterm configured for serial port 2.
Let me explain my setup:
ONE PC that has two serial ports, I have two programs running, the Stamp IDE and Hyperterm.
The Stamp IDE is configured to communicate on Serial Port 1, using a standard serial cable connected to the Stamp's dev board. This allows me to program the Stamp and then when the Stamp is running I can see the IDE's terminal window if I've used debug statements.
Hyperterm is running on the same PC using Serial Port 2 set for 9600,8,N,1 no flow control. All I'm using Serial port 2 for is for receive, so on the PC side all I need is PIN 2 of the DB9 (Serial Input) and PIN 5 (ground) on the DB9 of the second serial port.
Ok now to do test 1:
Program the stamp to output AT Commands that would be required to send a SMS message if it was connected to a modem. The Stamp Pin that I use is PIN 14 for the SEROUT command.
1. Now that I've got a program to do this it's time to test the Stamp's output, so I connect the STAMP PIN 14 (Serial Output) to the PC's Serial Port 2 PIN 2 (Serial Input).
2. I also need a ground to complete the circuit so I connect a ground from the Stamps Dev Board to the PC's Serial Port 2 PIN 5 (Ground).
3. In the Stamp's IDE program I click on RUN, this will download the program to the Stamp and Run the program.
4. Now I click on the Hyperterm Window. Note: I usually put a PAUSE statement in the beginning of the program so I will have time to activate the Hyperterm Window.
5. On my display I will have the Stamp IDE in the background and Hyperterm overlaid on top of the IDE.
6. In the Hyperterm Window I should see what I have programmed the Stamp to output. I use this to see if the AT Commands are being sent at the expected baud rate, and if they "look" correct. If I can answer yes to both questions then I do Test 2, otherwise I have a programming problem, or a hardware problem (Bad Stamp PIN, Bad PC Serial Port, or what ever)
Test 2:
I use the same setup as test 1, Hyperterm is still running, however I disconnect the wire between the Stamp SEROUT pin, in my case PIN 14, that is connected to the PC's serial Port 2 PIN 2 on the RS-232 DB9 and connect it to the modem's Serial output PIN 2.
My wiring is as follows:
Modem DB9 PIN 2 goes to the PC's Serial Port 2 DB9 PIN 2
PC'S DB9 PIN 5 goes to the Stamp Dev Board's Ground
Modem's DB9 PIN 5 goes to the Stamp Dev Board's Ground
Stamp's SEROUT to the modem's DB9 PIN 3
Now go back to Test 1 and do steps three, four, five, and return to here
In the Hyperterm window I should see the responses that the modem is outputting when the Stamp is sending AT Commands to the modem.
This setup will allow you to debug what AT Command the modem is failing on. After you have determined what AT command is failing, then you can go back and make modifications to the Stamps program to send what ever else is needed.
I've attached a screen shot of the terminal program that shows the modems responses to my Stamps output of the necessary at commands used to send a SMS message. Note: I use ProComm as my terminal program, Hyperterm works just as well.
Also I attached the Stamp Program that I'm using.
Post Edited (Mike Cook) : 8/6/2004 1:14:02 PM GMT
thus when i tried the second test, the sms could not be sent. so the problem might be the program downloaded into the BS2p.
thank u so much, mike. i really appreciate your help.. [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
http://www.sysinternals.com/ntw2k/freeware/portmon.shtml
You run PortMon first, set it up for the serial port to monitor, set it to display HEX or ASCII (I use HEX), then start Hyperterm. PortMon will show all the "unprintable" characters that Hyperterm won't display.
In test 2 were you monitoring the modem responses? If so at what AT Command was the Modem failing?
thank u so much.. i've tried all that u've suggested, n it works..
as for receiving sms, is SERIN needed? and is the procedure to program the bs2p to receive a sms same as sending sms? in terms of the hyperterminal settings and the transmitting of AT commands..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
AT
AT+CMGF=1
AT+CMGS="93912749"
test frm nokia 7110
but after connecting a nokia 7110 mobile phone, just like how i connected the wavecom modem to the stamp and the pc serial, there is no output displayed on the terminal and no message is received. i've already set the baudmode as needed is 19200-8-N-1, and i've saved the flow control off settings inside the nokia 7110 phone. the irony is that when i tested the nokia phone in the hyperterminal, it can work. the SMS is sent and the destination phone can receive it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
Why typing in hyperterm...in order for your command to be sent, you have to hit CR.· As far as the modem knows, the bytes it receives are for each character of the command and when a <CR> is received it knows to stop receiving and process that current command.
The BS2P was just outputting text string after text string after text string....so the modem just cued up this large command while it was waiting for the <CR> to execute it.
I was surprised that you didn't have to short back a couple of the handshake lines on the modem.· (CTS/RI/etc...tied together to fake it out).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://members.rogers.com/steve.brady
http://www.geocities.com/paulsopenstage
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
..:: aDiLa nUr ::..
I also want to try to send sms like you did. Can i have de testprogram you use and de wiring between my modem en BS2p
thnx
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
ing. H.S. Hanoeman
DSP-Solutions
You could probably just add some current limiting resistors and directly interface the basic stamp's pins to the cell phone itself without actually having to use the switching circuits inside the cable.