Pic to GSM Phone connection (HSerin problems)


Closed Thread
Results 1 to 40 of 289

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Well, i fidured out S65 now too. The cable is the key to success.
    S55 and S65 use different cable detection mechanisms. Yes, yes, phones novadays are detecting data cables. So, besides the usual Rx, Tx, GND lines, one needs other pins on the phone too, to tell the phone, that cable is present and the datatransfer will happen.
    After googling for some time, i found out, that pins 5,6, and 7 of the phone connector determine how the phone will detect the cable. If you connect 5,6,7 through 10k resistors to pin 2, Siemens S65 will detect it as DCA540, which is corresponding to the Siemens USB connection cable. And so the cable is detected, the phone will not respond to AT commands.
    Now, if you connect only 5,7 through the 10k resistors to the pin 2, phone will recognize this cable as DCA510, which is Siemens COM cable. And S65 then responding to AT commands. Bingo!

    For now, phone is connected straight to pic through 1k resistors on Rx Tx lines. And i tried to scope the Tx line from the phone and yes, i get a spike of about 3-3.5 volts (my scope is an old one) after sending the AT command to the phone. For comparizon, i scoped the Tx line of the pic, which gave about 4.5 volts spike.
    So, i conclude, that phone is receiving and anwering now.
    I guess, i will now send the Tx signal from the phone trough the MAX232, to insure proper levels for the pic.

    And here is mine testing code i use:

    DEFINE LOADER_USED 1


    'LCD defines
    DEFINE LCD_DREG PORTA 'set LCD data port
    DEFINE LCD_DBIT 0 'set starting data bit (0 or 4) if 4 bit bus
    DEFINE LCD_RSREG PORTA 'set LCD register select port
    DEFINE LCD_RSBIT 4 'set LCD register select bit
    DEFINE LCD_EREG PORTB 'set LCD enable port
    DEFINE LCD_EBIT 3 'set LCD enable bit
    DEFINE LCD_BITS 4 'set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 'set number of LCD lines
    DEFINE LCD_COMMANDUS 2000 'set command delay time in us
    DEFINE LCD_DATAUS 50 'set data delay time in us
    DEFINE OSC 20 'set crystal speed


    b0 var byte

    include "modedefs.bas"


    'Main program


    pause 1000 'wait for screen to sort get started
    start:




    lcdout $FE,1, "Sending AT.."
    pause 3000
    serout2 portc.4, 84, ["AT", 13]
    serin2 portc.5, 84, [b0]
    lcdout $FE, 1, b0


    pause 3000
    lcdout $FE,1, "Sending command.."
    serout2 portc.4, 84, ["at+cgmm", 13]
    serin2 portc.5, 84, [b0]
    lcdout $FE,1, b0
    pause 5000
    goto start
    end


    -------------------------------------------

    Now, i predict your comment about b0. With this i gust try to get anything from the phone, for example, after AT, b0 should be displayed as O (from OK), and after AT+CGMM it should be S (from S65). When i get correct response, i will change to WAIT("OK") or so.

    And one more detail. As you see, i used mode 84 in serout2, which is True mode. In inverted mode, which would be the 16468, phone does not respond (very strange, indeed).
    Last edited by Rufinus; - 16th October 2005 at 13:52.

  2. #2
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Switched back to HSEROT, HSERIN just to experiment. Seems to be fine, phone starts dialing! (extremely strange).
    But still cannot receive anything. Considering level shifter for the Tx line of the phone.
    Perhaps you have something simple in mind already?

  3. #3
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Connected Tx line from the phone through max232 to pic. Nothing.
    Than i desided to hook it up to pc. So the phone is receiving commands from the pic and outputting them to the pc.
    Here is what i get:

    AT#0D [len=2] <------it echoes AT command from the pic??
    #0D[len=0]
    OK#0D [len=3] <------ that is the answer
    at+cgmm#0D [len=7] <-----command to display model number(also echoed?)
    #0D[len=0]
    S65#0D [len=4] <----- answer
    #0D [len=1]
    OK#0D [len=3]

    So, now it is 100% clear, that phone is answering. But why then pic does not receive anything??? With or without max, i cant receive answers!

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170

    Default

    If you don't want the phone to echo (with PIC you sure do not want) try ATE0 (<- zero, not capital O).

    Ioannis

  5. #5
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Discovered strange thing. Works with S55. If i connect Tx line from the phone trough 1k resistor to one of the ports, serin2 will hang, waiting for an answer on that port. But when i quickly shorten this serin2 port to the ground, it starts working! And then hangs until the next command, then i short it and after it goes without problem to the end of the program. This trick does not work with HSERIN or SERIN. And only sometimes works with S65 phone.
    With max232 doesnt work anyways.

    Any ideas??



    Here is my code:


    DEFINE LOADER_USED 1

    'UART hardware defines
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1


    'LCD defines
    DEFINE LCD_DREG PORTA 'set LCD data port
    DEFINE LCD_DBIT 0 'set starting data bit (0 or 4) if 4 bit bus
    DEFINE LCD_RSREG PORTA 'set LCD register select port
    DEFINE LCD_RSBIT 4 'set LCD register select bit
    DEFINE LCD_EREG PORTB 'set LCD enable port
    DEFINE LCD_EBIT 3 'set LCD enable bit
    DEFINE LCD_BITS 4 'set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 'set number of LCD lines
    DEFINE LCD_COMMANDUS 2000 'set command delay time in us
    DEFINE LCD_DATAUS 50 'set data delay time in us
    DEFINE OSC 20 'set crystal speed



    b0 var byte
    include "modedefs.bas"



    'Main program


    pause 1000 'wait for screen to sort get started

    lcdout $FE,1, "Sending AT.."
    pause 2000
    HSEROUT ["AT", 13]
    pause 500
    HSEROUT ["ATE0", 13]
    serin2 portc.4, 84, [str b0\10]
    lcdout $FE, $C0, str b0\10
    pause 3000

    b0=0
    lcdout $FE,1, "Asking model.."
    pause 2000
    HSEROUT ["at+cgmm", 13]
    serin2 portc.4, 84, [SKIP 2, str b0\20]
    lcdout $FE, $C0, str b0\20
    pause 5000

    b0=0
    lcdout $FE,1,"Asking IMEI.."
    pause 2000
    Hserout ["at+cgsn", 13]
    serin2 portc.4, 84, [SKIP 2, str b0\20]
    lcdout $FE, $C0, str b0\20
    pause 5000

    b0=0
    lcdout $FE,1,"Asking capabilities:"
    pause 2000
    Hserout ["at+gcap", 13]
    serin2 portc.4, 84, [SKIP 2, str b0\20]
    lcdout $FE, $C0, str b0\20
    pause 5000


    b0=0
    lcdout $FE,1,"Asking time.."
    pause 2000
    Hserout ["at+cclk?", 13]
    serin2 portc.4, 84, [SKIP 2, str b0\20]
    lcdout $FE, $C0, str b0\20
    end

  6. #6
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762

    Default

    Rufinus,
    I hate to say that, but you have got to do some homework.

    Make yourself familiar with the principles of serial communitation and the datasheet of a MAX232.

    Pay special attention on the MODES, (TRUE/INVERTED)

    If you receiver is expecting the data line to be ILDE HIGH and your transmitter IDLES LOW, (and vice versa) you will see all kinds of strange phenomenon.

    You are not really connecting one of the RS232 Outputs of the MAX to the phone or PIC, are you?
    (you are about to kill the PIC and/or the Mobile)
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  7. #7
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    RS232 output of max i do connect to the pic, but through 22k resistor.
    Pic to phone both ways goes through 1k resistor.
    There is no reason to connect rs232 straight to phone anyways, so i dont and would not. There is no problem now with the phone receiving commands. The problem is to receive answers on pic.

    Regarding modes - tried both true and inverted, tried different baud rates.

    Now it is connected to the pic without MAX. I still think it is the problem of levels.

    If you have a good link in mind about serial communication, i would appreciate. Otherwise, gonna google.

    Thanks for adwise anyways.
    Last edited by Rufinus; - 17th October 2005 at 22:50.

Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 01:52
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 15:46
  3. problem with the GSM controller
    By Dariolo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2009, 21:33
  4. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 08:57
  5. Pic to GSM Phone connection
    By samertop in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th July 2005, 14:40

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