SEROUT2 to GSM Modem


+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006
    Posts
    6

    Unhappy SEROUT2 to GSM Modem

    Hi,

    I am using a GM862-QUAD GSM modem from Roundsolutions, via AT commands generated from a PIC16F74 running picbasic pro.

    here is my simplified code:

    'Initialising Variables
    TXPIN VAR PORTD.3 'TX PIN
    RXPIN VAR PORTD.2 'RX PIN

    RL1 VAR PORTB.2 'RELAY OUTPUT
    STAT VAR PORTB.1 'STATUS LED

    BAUD CON 396 'BAUD RATE = 2400 N 8 1

    RELAYFLAG VAR BYTE

    ADCON1 = 6

    DEFINE OCS 4

    START:

    pause 3000 ' start up delay

    'first command is to set the text mode
    SEROUT2 TXPIN, BAUD, ["AT+CMGF=1",13] '-- answer 'OK'

    PAUSE 2000 ' 2 second delay to allow modem more than enough
    ' time to respond

    'text setup
    SEROUT2 TXPIN, BAUD, ["AT+CSMP=17,167,0,0",13] '-- answer 'OK'

    PAUSE 2000 ' allow modem to respond

    'send a message without saving
    SEROUT2 TXPIN, BAUD, ["AT+CMGS=",34,"xxxxxxxxxxx",34,13] '--answer '>'
    PAUSE 500 'short delay

    ' add the body of the message ending with ctrl-z
    SEROUT2 TXPIN, BAUD, ["WORK",26]

    PAUSE 500 'short delay
    HIGH STAT 'completion indicator


    STOPLABEL:

    ' stay here when complete
    GOTO STOPLABEL

    The code started life out listening for the responses before continuing - but as I wasn't having much luck with it I stripped all this out!

    Ok, so whats happening or not happening.

    I have setup hyperterminal to send out these exact same commands and this works fine. I also have the luxary of a serial data analyser so I can monitor the data being sent and received. When send these commands via hyperterminal the modem sends the code to the number (note xxxxxxxxxxx - for privacy!) and all is well.

    I then disconnect hyperterminal and instead connect my PIC circuit and let the code above run. I monitor the results on my serial analyser and the commands send to and received from the GSM modem look indentical! BUT THE MESSAGE AINT SENT! I cannot fathom what is going wrong!?

    both the code and hardware seem to function because I get the same serial data - apart from hyperterm generated works and PIC generated doesnt!?

    Can anyone advise.

    Thank you and Regards

    Tom
    Last edited by tommyers; - 9th August 2006 at 08:30.

  2. #2
    Join Date
    Aug 2006
    Posts
    6

    Default

    as an addition to the previous post.........

    I have just connected my PIC hardware to my serial lead back to my PC and then run hyperterminal. The commands which I think I am generating by the PIC are being received ok by hyperterminal!

    Cheers

    Tom

  3. #3
    frustrator's Avatar
    frustrator Guest

    Default ???

    Mate that's a good one.

    The only thing I can think of at the moment is to make sure all the cables to the modem are wired around the correct way.

    Is there any data the computer sends first via hyperterm to initialize the modem?

    Please let me know how you go with this...

    Chris

  4. #4
    Join Date
    Aug 2006
    Posts
    6

    Default

    Hi Chris,

    Thank you for your post.

    I have since solved the problem which I reported. I had already tried your suggestion, since there was two way communication between the modem and hyperterm / PIC because I were receiving acknowledgements from the modem to some commands and error messages from others.

    The commands which gave me errors were those which generated a transmission i.e. AT+CMGS or the command which transmits a previously stored message at some loction <i>, AT+CMSS. The response from the AT+CMSS was +CMS ERROR: 321 which suggested I were trying to transmit an invalid memory index, which I knew to be false as I had successfully transmitted the message in this location using hyperterminal! Annoyingly, there was no error reported when using the AT+CMGS command, it just sat there and no SMS was received on my phone!

    I bolied the problem down to something with my PIC hardware / software. Moreover it was something to do with the transmission commands, as every other command worked.

    I noticed that when I tried to transmit an message the power LED on the board 'dipped' in brightness --- further investigation led me to spot that the modem needed 2A peak for transmission, however the power supply I were using only could deliver 1.1A. This seemed enough when ONLY the modem was being powered and the commands were coming from hyperterm, however when all my PIC circuit were sucking juice and trying to transmit then there was not enough power for everything!

    I am sure you will agree this is a real suctle problem! I would have thought that there would have been some 'transmission error' messages which would be returned in situations like this - some feedback for the user!

    What project are you working on? Are you using a GSM modem?

    Regards

    Tom

  5. #5
    frustrator's Avatar
    frustrator Guest

    Default

    Haha thats a good one. I actually thought of that today, the power drain would increase.

    Your frustration came through in that first post. I sure would be.


    Mate I am working on a GSM/GPRS terminal project. I wish to connect to a GPRS network, then access a mail server. Simple?

    My problem is at the moment I can connect to my APN gateway, but hyperterm just sits there saying CONNECT. Great, I've connected to the GPRS APN, but can't get any further. I'm thinking I may have to write software to connect but surely you could do it all through hyperterm? I'm really unsure, it's all new to me.

    I use the AT+CGDCONT to define my APN then dial *99***1# to connect. That's all I can find in the manual. Any ideas?

    Chris

  6. #6
    Join Date
    Aug 2006
    Posts
    6

    Default

    Hi Chris,

    I am not familar with GPRS, I have only used a GSM modem. The modem I have been using is the GM862-QUAD from roundsolutions. I speak very highly of roundsolutions (www.roundsolutions.com). They offer great quality products delivered to your door via UPS. They have a very repsonsive and upto date online from, discussing many aspects of their products, they have a great technical support team, should you ever need them - which will be unlikely as their documentation is written from an engineering perspective and soon gets you up and running.

    May I ask whose modem you are using? Also, if you can provide me with some more details about your project - documentation, software etc.. I would be happy to take a look (I may fancy doing some GPRS work some day!). You may email me on: [email protected]s16.fsnet.co.uk

    Cheers

    Tom

Similar Threads

  1. Interface Pic --> Max232 --> GSM Modem
    By SangkiMangki in forum GSM
    Replies: 1
    Last Post: - 28th September 2013, 13:57
  2. Serout and 18F87J50
    By Glenn_Webber in forum Serial
    Replies: 8
    Last Post: - 20th November 2009, 15:26
  3. SLOW Serin2 and Serout2
    By dragons_fire in forum General
    Replies: 3
    Last Post: - 26th June 2009, 03:38
  4. Replies: 10
    Last Post: - 14th April 2007, 05:34
  5. PIC18F2550 and GSM modem
    By zach in forum GSM
    Replies: 7
    Last Post: - 28th November 2006, 10:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts