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

    Question

    Here is the code i used to test it with PC:

    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



    'Main program


    pause 1000 'wait for screen to sort get started
    start:
    lcdout $FE,1, "Sending number.."
    pause 1000
    HSEROUT ["atd **********", 13, 10]
    HSERIN [wait("OK")]


    lcdout $FE, 1, "Got it!"
    pause 1000
    goto start
    end


    It's running on 16f870 connected trough max232 to com2 port on pc, and i have no problem!
    When i connect the phone following way:
    PIC--->MAX232--->Data cable (original Siemens)--->Phone

    Nothing happens!
    That must be the cable. But from other side, phone is listening to commands from pc, using same cable with only 3 wires connected: Rx, Tx, GND
    Miricle..

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

    Default

    Quote Originally Posted by Rufinus

    'Main program

    pause 1000 'wait for screen to sort get started
    start:
    lcdout $FE,1, "Sending number.."
    pause 1000
    HSEROUT ["atd **********", 13, 10]
    HSERIN [wait("OK")]

    lcdout $FE, 1, "Got it!"
    pause 1000
    goto start
    end
    Try to add on top of your program:

    HserOut ["AT",13,10] ;Sync modem to 9600 baud

    Also if you power up PIC at the same time as the mobile you won't get reliable connection with the phone until the phone is on the network.

    Ioannis

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

    Unhappy

    Thanx, but i tried this already. Nothing. And i do not power up the phone in the same time. Phone is just on costantly.

    I thougt, maybe when i send AT, phone answers OK, but pic does not capture it (for whatever reason). So i changed to atd **********, because even if pic is not capturing the answer, phone should react (dial given number).
    I started yesterday to build new cable, just typical 3 wires based on standard MAX232. Let's see what this will give. I will test it with the phone--->pc connection first, and than test with pic. And if this doesnt work, i should consider direct connection from pic to phone without max232 but just trough 1 kOhm resistors. Shall i send in inverted mode then?

    And i measured voltages on the original cable, both form the phone's side and rs232 side. Cable was pluged in the phone and not in rs232. I can give them here, if somebody is interested. It seems, that phone is powering the cable's logic.

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

    Default

    If you miss the MAX232 then send in inverted mode. The MAX does this inversion.

    Another thing you may try is to use Numeric mode instead Alphanumeric. Then the phone answers 0 (zero) for OK, 4 for error etc.

    Did you double check that you have not connected Rx, Tx the wrong direction? Try to cross connect them. Don't worry, RS232 is able to withstand this if it wrong.

    Ioannis

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

    Default

    OK, i will try again without MAX using inverted mode. How to set it in HSerout command?
    I am sure about the RX TX connection, besides, with the pc communication there are no problems.
    And i will try also numeric mode (atv0, if i am corect?)

    Well, it would be easy to give up on it, but it looks like nobody tried yet with Siemens. And anyways i like doing this things, so i will keep on going untill its working anyhow, and than i will try to get it working with original cable (sometimes i am an optimist )

    Thanx for your help, Ioannis, i appreciate it.


    P.S. I have a feeling, that this must be some stupid little ditail which is missing. As allways, so..

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

    Default

    On the matter of Rx Tx connection let me insist on. Try to change and see what happens.

    Also with siemens (cannot recall the model) had no problem 2-3 years ago.

    Whatever you connect to the PIC as modem and sending "AT" it should reply "OK".

    Ioannis

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

    Default

    Rufinus,

    I guess the problem is with the Siemens Datacable.
    Most cables have some embedded electronics.
    (At least a level shifter, probably more..)

    This is usually powered from the PCs serial port (DTR & RTS)
    So if you are using one of these cables to connect the phone you will need a MAX232 on the PIC end as well.
    And you have to set the correct levels at DTR & RTS on the MAX232 at the PIC end in order to supply the cables embedded electronics.

    As far as I can remember The Siemens interface is 5V tolerant, so all you need is 3 straight wires from the PIC to the Phone (no MAX232 at all).
    But then you'll have to use SERIN2 /SEROUT2 instead of HSERIN/HSEROUT since HSERIN/HSEROUT doesn't allow to toggle between true/inverted mode.
    Last edited by NavMicroSystems; - 14th October 2005 at 18:54.
    regards

    Ralph

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



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

    Default

    OK, just finished selfmade cable.
    Rx and Tx do through the MAX, and CTS(5), RTS(6), DCD(7) are connected to the GND(2) trough 10k resisors. Without this it does not work. Or other way is to connect RTS to CTS straigt, it will communicate with the PC then also. Communication with the PC was fine in both cases. So, sefmade cable is considered to work correctly, at least for the AT commands.

    Tried swapping Rx and Tx as Ioannis sugested, but it just made my phone to go off. After restart it was working fine. So, nothing was wrong with my pinout.


    Now, NavMicroSystems, i am not that sure about powering cable from COM port. It is rather powered by the phone itself (as strange as it sounds). As a proof i can say, that i was able to communicate with the PC, using original cable with only 3 wires (Rx, Tx, GND), rest of them i disconnected for the experimental sake. And in this configuration it was working with hyperterm or some similar software except original Siemens software, which did not detect the phone. Only when you connect also CTS line, the phone will be detected by the Siemens software.

    I should mention again, i'm experimenting on S65 and S55 phones which are rather new, and they are different from older Siemens models, pinout of the phone's interface and connector itself are different.


    So, now my setup looks like this: PIC--->MAX232--->MAX232(selfmade cable)--->Pnone

    From above, and as NavMicroSystems says, both MAXes can be ommited. Will try then connecting straight PIC to Phone using serout2 in inverted mode.
    Wish me good luck
    Last edited by Rufinus; - 14th October 2005 at 18:07.

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