GSM modem not working with PIC! Both modem & PIC work fine with PC


Closed Thread
Results 1 to 12 of 12
  1. #1

    Exclamation GSM modem not working with PIC! Both modem & PIC work fine with PC

    I am trying to connect my GSM modem sim300 with my PIC 16F877A but it is not working. I tried my modem with few AT commands with my PC and it works fine. I tried communicating with my PIC using my PC and it worked fine. BUT everything stops working when I connect my PIC to my Modem.
    I use MAX 232 converter. Connection are as follows:

    PIC PortC.6 ---> MAX 232 Pin-11
    PIC PortC.7 ---> MAX 232 Pin-12

    Modem Pin2 - Max 232 Pin-13
    Modem Pin3 - Max 232 Pin-14

    Modem Pin5 - Common Ground with PIC

    My code is as follows:

    Code:
    DEFINE OSC 4
    ADCON1=7
    CMCON=7
    INTCON=0
    OPTION_REG.7=0
    TRISA=0 : PORTA=0
    TRISB=0 : PORTB=0
    TRISC=%10000000 : PORTC=0
    TRISD=0 : PORTD=0
    TRISE=0 : PORTE=0
    CCP1CON=0
    
    DEFINE DEBUG_REG PORTC
    DEFINE DEBUG_BIT 6
    DEFINE DEBUG_BAUD 4800
    DEFINE DEBUG_MODE 0
    
    DEFINE DEBUGIN_REG PORTC
    DEFINE DEBUGIN_BIT 7
    DEFINE DEBUGIN_MODE 0
    
    high portb.7
    
    check:
    				DEBUG "AT",13,10
    				DEBUGIN 5000,check,[WAIT("OK")] : pause 500
    				Low PortB.7
    end
    As you can see in the code, upon receipt of "OK" Led at portb.7 should go low, but it never does.
    I don't know if I am communicating right with right connections and baud rate settings or my modem is faulty (can't be as it works with my PC )
    When I connect the Modem to my PIC I do have to make sure in Flow-control option "Hardware" is selected, otherwise I don't see anything on my Hyperterminal screen.

    I searched on the net about disabling this option and I found one command "AT+IFC=0,0". I tried that as well but it is still not working with my PIC.
    ___________________
    WHY things get boring when they work just fine?

  2. #2


    Did you find this post helpful? Yes | No

    Default Update

    Any-one there - Please help

    I also tried replacing Max232 - but no results. Do I need to put another pin Ground of the modem, I am only using pin 2/3/5 (Tx/Rx/Gnd) of the modem while connecting wih the PIC.
    I also tried fliping Tx with Rx but no results still.
    ___________________
    WHY things get boring when they work just fine?

  3. #3
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default ttl to ttl

    If both can talk to your computer through a max232, then they are both ttl devices. Pull the max232 out, and connect tx to rx and rx to tx and see what happens. Make sure they are both on the same voltage.

    Walter

  4. #4


    Did you find this post helpful? Yes | No

    Question

    Thanks for the answer. The problem is that I am using a complete modem. I am sure it has MAX232 inbuilt. I just have to connect the rs232 serial cable to it and my pc. I cannot take out MAX232 from the modem.
    It's pin 2 (DB9-connector) has a voltage of -5.85V.

    Is it possible that I have to put more pins ground apart from pin5 of DB9-Connector? Thanks
    ___________________
    WHY things get boring when they work just fine?

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default

    Although I am sure it works on PC with just TX, RX nd Gnd, have tried to connect to PC just with these 3 wires?

    Also are you sure about 4800 baud?

    Ioannis

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    Although I am sure it works on PC with just TX, RX nd Gnd, have tried to connect to PC just with these 3 wires?
    I tried it now, I could not type in my hyperterminal anymore as soon as I connected my modem to the PC with only 3 wires. As soon as I connected 9 pin serial cable, everything starts working fine.

    Also are you sure about 4800 baud?
    Yes, baud rate is 4800.
    ___________________
    WHY things get boring when they work just fine?

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I tried it now, I could not type in my hyperterminal anymore as soon as I connected my modem to the PC with only 3 wires. As soon as I connected 9 pin serial cable, everything starts working fine.
    Was hyperterminal in hand shaking mode?

    See the modem manual, if the modem is in handshaking mode by default, in such a case you have to set it for no flux controll.

    Al.
    All progress began with an idea

  8. #8


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by aratti View Post
    Was hyperterminal in hand shaking mode?

    See the modem manual, if the modem is in handshaking mode by default, in such a case you have to set it for no flux controll.

    Al.
    I have not got the manual but I have opened the modem and saw that sim300 is the module which the modem is built on. I have checked sim300 datasheet but could not understand many things as I do not have too much of a technical background.

    Can you advise me, what AT commands can do this job.
    I also find this on the net - http://www.london-electronics.com/alpha_232_conns.gif
    Is this an alternate way to go to solve this problem (RTC - CTS connected together & also pins 6,1,4 connected together? I do not want to try it unless it is safe to do so, only have 1 modem

    Also, how can I find out if Hyperterminal is in Handshaking mode? One more thing I would like to mention here which I read from sim300 datasheet is that the modem supports and by default has Autobaud from 1200 to 19200.
    ___________________
    WHY things get boring when they work just fine?

  9. #9
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Also, how can I find out if Hyperterminal is in Handshaking mode?
    When you set the baud rate you can set also the flow mode. See the three snaps attached.

    Al.
    Attached Images Attached Images    
    All progress began with an idea

  10. #10


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    When you set the baud rate you can set also the flow mode. See the three snaps attached.

    Al.
    No, the handshake mode is "None".
    ___________________
    WHY things get boring when they work just fine?

  11. #11


    Did you find this post helpful? Yes | No

    Default

    The setting of hyperterminal may not tell you whether the modem itself needs flow control . Typically if flow control is turned off, the RTS pin is set "high".

    One thing you can try is either to set no flow contol on the SIM300(if you can), or wire an output RS232 buffer to pin 7 of the serial cable and pull the input low, which should make the RTS active on the SIM300.
    Tim Barr

  12. #12
    Kolesnikov's Avatar
    Kolesnikov Guest


    Did you find this post helpful? Yes | No

    Default sim300

    This is a feature of the sim300 module. If you connect it via 3 wires then you have to connect its RTS with CTS - these are pins 7 and 8 on the DB9 RS232.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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