Shop OBEX P1 Docs P2 Docs Learn Events
Working with the gm862 modem please help — Parallax Forums

Working with the gm862 modem please help

electromanjelectromanj Posts: 270
edited 2010-04-19 03:07 in Propeller 1
Hello!
I am working with the gm862 modem and have a question.

Background: I have been able to call numbers and send text message from gm862 module with hyperterminal, and parallax serial terminal. I am able to now call out with the propeller, but am unable to send text message. The procedure for sending text message is to set up the module for sending text message, send at command with phone number to send message to, wait for prompt, then type message, then send control z. I am having trouble with the control z since I don't have a keyboard attached anymore, just the propeller. From what I have read 26 is the DEC equivelent of control z. Any help would be very much appriciated! Here is the program I have written in spin. Very crude as I am still trying to learn·SPIN.

''file:GM862Prop
CON
· _clkmode····· =xtal1+pll16x
· _XINFREQ····· =5_000_000
· rx_PIN······· =5
· tx_PIN······· =6
· cr··········· =13
· cz··········· =26
obj
· debug: "fullduplexserial"

pub ledtest
· dira[noparse][[/noparse]0]:=1····················· 'set p0· to output
· outa[noparse][[/noparse]0]:=1····················· 'set p0· low
· waitcnt(clkfreq*1+cnt)
· dira[noparse][[/noparse]1]:=1···················· 'set p1 to output
· outa[noparse][[/noparse]1]:=1···················· 'set p1 low
· waitcnt(clkfreq*1+cnt)
· dira[noparse][[/noparse]2]:=1···················· 'set p2 to output
· outa[noparse][[/noparse]2]:=1···················· 'set p2 low
· waitcnt(clkfreq*1+cnt)
· outa[noparse][[/noparse]0]:=0···················· 'set p0 low
· waitcnt(clkfreq*1+cnt)
· outa[noparse][[/noparse]1]:=0···················· 'set p1 low
· waitcnt(clkfreq*1+cnt)
· outa[noparse][[/noparse]2]:=0···················· 'set p2 low
· waitcnt(clkfreq*1+cnt)
· init
PUB Init
· Debug.Start(5,6, 0,9600)
· waitcnt(clkfreq * 2 + cnt)
·

· gm862init······································ ' Call the·gm862init method·
pub gm862init
·
·
· Debug.str(String("atbnd=1", cr))·· 'set gm862 to n america
· outa[noparse][[/noparse]0]:=1
· waitcnt(clkfreq*10+cnt)··········· 'wait 10 sec for gm862 to register with network
· outa[noparse][[/noparse]0]:=0
· debug.str(string("atd5555555555;",cr)) 'dial generic hollywood number
· outa[noparse][[/noparse]1]:=1
· waitcnt(clkfreq*15+cnt)················ 'let phone ring for 15 sec
· outa[noparse][[/noparse]1]:=0············
· debug.str(string("ath",cr))·········· 'hang up phone
· outa[noparse][[/noparse]2]:=1
· waitcnt(clkfreq*5+cnt)
· outa[noparse][[/noparse]2]:=0
· text
pub text
· debug.str(String("at+cmgf=1",cr))
· debug.str(String("at+cnmi=0,0,0,0,0",cr))
· debug.str(String("at+csmp=17,167,0,0",cr))
· debug.str(String("at+cpms= me,sm,sm" ,cr))·· 'configure modem for text message
· debug.str(String("at+cmgs=5555555555;",cr))·· 'select number to send sms to
· outa[noparse][[/noparse]1]:=1
· waitcnt(clkfreq*5+cnt)
· outa[noparse][[/noparse]1]:=0
· debug.str(String("hello world",cr))
· waitcnt(clkfreq*5+cnt)
· debug.str(cz)·········· 'trying to send control z
· outa[noparse][[/noparse]2]:=1
· waitcnt(clkfreq*5+cnt)
· outa[noparse][[/noparse]2]:=0
·

Comments

  • BradCBradC Posts: 2,601
    edited 2010-04-19 00:08
    change the debug.str(cz) to debug.tx(cz) or use debug.str(string(cz)).

    You are asking the debug object to send a string located at hub address 26, and are therefore probably spewing all manner of garbage at the poor modem! [noparse];)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You only ever need two tools in life. If it moves and it shouldn't use Duct Tape. If it does not move and it should use WD40.
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 00:18
    thanks, I will try that right now.
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 00:25
    Tryed both neither worked.
    I wonder about
    debug.str(String("at+cpms= me,sm,sm" ,cr)) 'configure modem for text message
    in the gm862 manual it says to send AT+cpms="me","sm","sm",CR
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 00:32
    Here is a link to the software manual for the gm862. The pages that deal with sms start at page 56.
  • BradCBradC Posts: 2,601
    edited 2010-04-19 00:32
    electromanj said...
    Tryed both neither worked.
    I wonder about
    debug.str(String("at+cpms= me,sm,sm" ,cr)) 'configure modem for text message
    in the gm862 manual it says to send AT+cpms="me","sm","sm",CR

    That'd be string("AT+cpms=",34,"me",34,",",34,"sm",34,",",34,"sm",34,CR)

    I have not played with GSM modems with AT command sets, so I don't know. I'm just trying to help out with actually making it do what you appear to be asking it to do [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You only ever need two tools in life. If it moves and it shouldn't use Duct Tape. If it does not move and it should use WD40.
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 00:43
    I really appriciate your help and I really wish i could spell appriciate correctly!
    I will try that right now, be back ina few!
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 00:52
    Tryed that. didn't work.

    here is my code now.

    ''file:GM862Prop

    CON
    · _clkmode····· =xtal1+pll16x
    · _XINFREQ····· =5_000_000
    · rx_PIN······· =5
    · tx_PIN······· =6
    · cr··········· =13
    · cz··········· =26

    obj

    · debug: "fullduplexserial"

    pub sercominit
    · dira[noparse][[/noparse]5]:=0
    · dira[noparse][[/noparse]6]:=0
    · ledtest
    pub ledtest
    · dira[noparse][[/noparse]0]:=1····················· 'set p0· to output
    · outa[noparse][[/noparse]0]:=1····················· 'set p0· low
    · waitcnt(clkfreq*1+cnt)
    · dira[noparse][[/noparse]1]:=1···················· 'set p1 to output
    · outa[noparse][[/noparse]1]:=1···················· 'set p1 low
    · waitcnt(clkfreq*1+cnt)
    · dira[noparse][[/noparse]2]:=1···················· 'set p2 to output
    · outa[noparse][[/noparse]2]:=1···················· 'set p2 low
    · waitcnt(clkfreq*1+cnt)
    · outa[noparse][[/noparse]0]:=0···················· 'set p0 low
    · waitcnt(clkfreq*1+cnt)
    · outa[noparse][[/noparse]1]:=0···················· 'set p1 low
    · waitcnt(clkfreq*1+cnt)
    · outa[noparse][[/noparse]2]:=0···················· 'set p2 low
    · waitcnt(clkfreq*1+cnt)
    · init
    PUB Init

    · Debug.Start(5,6, 0,9600)
    · waitcnt(clkfreq * 2 + cnt)
    ·


    · gm862init······································ ' Call the Main method·
    pub gm862init
    ·
    ·
    · Debug.str(String("atbnd=1", cr))·· 'set gm862 to n america
    · outa[noparse][[/noparse]0]:=1
    · waitcnt(clkfreq*10+cnt)··········· 'wait 10 sec for gm862 to register with network
    · outa[noparse][[/noparse]0]:=0
    · debug.str(string("atd6202902353;",cr)) 'dial generic hollywood number
    · outa[noparse][[/noparse]1]:=1
    · waitcnt(clkfreq*15+cnt)················ 'let phone ring for 15 sec
    · outa[noparse][[/noparse]1]:=0············
    · debug.str(string("ath",cr))·········· 'hang up phone
    · outa[noparse][[/noparse]2]:=1
    · waitcnt(clkfreq*5+cnt)
    · outa[noparse][[/noparse]2]:=0
    · text
    pub text

    · debug.str(string("at+fclass=8"))
    · debug.str(String("at+cmgf=1",cr))
    · debug.str(String("at+cnmi=0,0,0,0,0",cr))
    · debug.str(String("at+csmp=17,167,0,0",cr))
    · debug.str(string("AT+cpms=",34,"me",34,",",34,"sm",34,",",34,"sm",34,CR))
    · debug.str(String("at+cpms= me,sm,sm" ,cr))·· 'configure modem for text message
    · debug.str(String("at+cmgs=6202902353;",cr))·· 'select number to send sms to
    · outa[noparse][[/noparse]1]:=1
    · waitcnt(clkfreq*5+cnt)
    · outa[noparse][[/noparse]1]:=0
    · debug.str(String("hello world",cr))
    · waitcnt(clkfreq*5+cnt)
    · debug.str(string(cz))

    ·········· 'trying to send control z
    · outa[noparse][[/noparse]2]:=1
    · waitcnt(clkfreq*5+cnt)
    · outa[noparse][[/noparse]2]:=0

    I know I left the real phone number in but it is a walmart prepaid so maybe I'll get some interesting phone calls![noparse]:)[/noparse]
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 01:12
    can you please explain what is happening with the "34"
    Quote: That'd be string("AT+cpms=",34,"me",34,",",34,"sm",34,",",34,"sm",34,CR)
  • BradCBradC Posts: 2,601
    edited 2010-04-19 01:19
    Each command in the send text section is supposed to have a response from the modem. You are not waiting for the modem to respond between commands and as a result are probably confusing the poor thing.

    As a kludge, try putting a wait after each command. Also, you now have 2 different at+cpms lines. Comment one of them out.

    Your phone number in the at+cmgs needs to be surrounded by quotation marks. (ascii 34). Use a method similar to the one I showed above...
    string("at+cmgs=",34,"12345",34,cr)

    To make it easier for your sent text, end it with cz
    string("Hello World",cr,cz)
    That removes the need for the separate cz at the end.

    If you echoed the response from the modem to a serial terminal, or tv or something it would make it easier to debug as you could see the responses to watch what is going wrong. Have you tried connecting the modem to a terminal program and doing this stuff by hand to check it will actually work?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You only ever need two tools in life. If it moves and it shouldn't use Duct Tape. If it does not move and it should use WD40.
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 01:36
    BradC said...
    Each command in the send text section is supposed to have a response from the modem. You are not waiting for the modem to respond between commands and as a result are probably confusing the poor thing.

    As a kludge, try putting a wait after each command. Also, you now have 2 different at+cpms lines. Comment one of them out.

    Your phone number in the at+cmgs needs to be surrounded by quotation marks. (ascii 34). Use a method similar to the one I showed above...
    string("at+cmgs=",34,"12345",34,cr)

    To make it easier for your sent text, end it with cz
    string("Hello World",cr,cz)
    That removes the need for the separate cz at the end.

    If you echoed the response from the modem to a serial terminal, or tv or something it would make it easier to debug as you could see the responses to watch what is going wrong. Have you tried connecting the modem to a terminal program and doing this stuff by hand to check it will actually work?

    Thank you I was wondering about the response from the modem. While using the pc and terminal I was getting a response back after every AT commmand. Also thanks I forgot to take out the first cpms command,Duuurrrrr. I am going to try without that clutter.
    "quote:" Your phone number in the at+cmgs needs to be surrounded by quotation marks. (ascii 34). Use a method similar to the one I showed above...string("at+cmgs=",34,"12345",34,cr)
    The phone number dialing worked as is but I will definetly try it that way.

    I have tryed this with the parallax serial terminal and hyperterm and worked fine. I do miss the fact that on the terminals I had feedback from the modem. I am not sure how to get feedback from the modem now. The breakout board I am using is from sparkfun and you have to desolder jumpers to isolate the usb port on the breakout board. I still have the usb from the prop plub but am not sure how to send feedback from the module rx tx to the prop pin 5 pin 6 to the propplug pin 31 pin 30.
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 01:50
    stay tuned........... I think we got it!
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 02:03
    tongue.gif·tongue.giftongue.gif DUUUUUUUUUUUUUUUUUUDE!
    All is good in the world.
    Got the text message!
    Thank you so much Brad C. I can't tell you how much I
    appreciate your help!!!!!!
    The final key was the elemination of the· debug.str(String("at+cpms= me,sm,sm" ,cr))·· 'configure modem for text message
    and also the pauses to allow the module to respond back. After I removed the above mentioned string and added the pauses it all worked fine. Thanks again. You are an asset to this forum!!!!!! And a wonderful instructor!!!
  • BradCBradC Posts: 2,601
    edited 2010-04-19 02:26
    electromanj said...
    Thanks again. You are an asset to this forum!!!!!! And a wonderful instructor!!!

    No worries, glad it's working. Actually you must have caught me on a good day, normally I'm just a Mr grumpy pants!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You only ever need two tools in life. If it moves and it shouldn't use Duct Tape. If it does not move and it should use WD40.
  • electromanjelectromanj Posts: 270
    edited 2010-04-19 03:07
    Thanks again. I really mean it!

    I'm sure everyone here knows the joy that one feels when a·challenge they've been wrestling with for days finally starts to make sense!
Sign In or Register to comment.