View previous topic :: View next topic |
Author |
Message |
Guest
|
Can´t fake hyperterminal..... (GSM help) |
Posted: Tue Aug 04, 2009 6:20 am |
|
|
hi all,
I have some issues communicating with a SE T290A mobile.
my setup is a PIC16F877A-->Max232-->DRS11 Data Cable, Cellphone.
when i send AT commands through hyperterminal, it works perfectly. the cellphone responds and i have full control over it.
but when i write a simple program to test if the cell responds to the pic,
it doesnt work.
my program sends 3 chars over the UART --> Printf("AT\r");
then i check for the cell response... which is an echo of what i send and
the string "OK"
a total of eight characters are returned by the cell.
A
T
\r ------> untill this character, its all echoed by the cell, sent by the pic.
\n
O
K
\r
\n
i thought the problem was flow control, using a DB9 Breakout board, i tested wich pins needed to be grounded, or tied high...
and found that 5v where needed in pin 4.
i conected the cell to hyperterminal using a null modem cable...3 wires..
didnt work, so, like mentioned before, i then tied pin 4 to 5v and it worked without any issues... so im sure i got the flow control issues of the cellphone or the cable figured out and solved....
but it still doesnt work.
when in hyperterminal... i type "AT" and hit enter....cellphone responds
on my PIC i send "AT\r"...... which i believe to be the same, no?
could that be the problem?
what is "enter" in hex? could that be the problem?
that my cellphone is not recognizing \r as "enter"?
thanks in advanced
g |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Tue Aug 04, 2009 6:23 am |
|
|
A
T
\r ------> untill this character, its all echoed by the cell, sent by the pic.
\n
O
K
\r
\n
What do you notice about the echoed chars back ?
'\n' ?
try sending
printf("AT\r\n");
Hyperterminal is proberbly set to send \r\n (<cr><nl>) when you press enter. |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Tue Aug 04, 2009 6:54 am |
|
|
Hi Wayne_
thanks for your input, i will try that...
i never did know who sent the \n after i pressed enter...i just assumed
it was the cell.
as in:
A
T
\r ------> untill this character, its all echoed by the cell, sent by the pic.
\n -----> actual response from pic.
O
K
\r
\n
also,
Quote: | Hyperterminal is proberbly set to send \r\n (<cr><nl>) when you press enter. |
i believe not, because when i have text on hyperterminal
and i press enter, the cursor only returns.... no newline.
still i think you have a valid point and i will try it.
thank you
g _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Tue Aug 04, 2009 7:00 am |
|
|
Look in properties/ Ascii Setup on hyperterminal and see if
"Send line ends with line feeds" is checked!
Also, Hyperterminal is not the best terminal program and I would not rely completely on what it shows!
CCS has Siow (Serial Input output monitor) which is nuch better, especially for testing as it can show you the hex values of the data and who is sending what! |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Tue Aug 04, 2009 7:33 am |
|
|
can i download that from their web page?.... _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Tue Aug 04, 2009 7:35 am |
|
|
Gabriel wrote: | can i download that from their web page?.... |
No idea sorry. hopefully someone else will be able to answer. |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Sun Aug 09, 2009 11:23 am |
|
|
Siow comes with the compiler. I had no idea. Thanks for the input though.
It worked great. Using Siow I figured out exactly how my cellphone replies.
Turns out there was one more character than expected.
Siow also has a control lines display which tells you which lines are active.
Its pretty nice.
I just figured out because of that feature that my problem is not really my code but my flow control lines.
How do I fix this? I anticipated some issues with flow control before I built a board specifically for this project.
My RS232 output (db9) is basically a null modem.
3 lines, no loop back, just a plain dumb null modem.
But I included an option on my board where I can feed 5v into every other pin in the connector (no resistor) OR leave the pin floating (exept pin 9) which is the ring.
I'm starting to wonder if that was usefull at all.
Help appreciated.
g _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Mon Aug 10, 2009 11:44 am |
|
|
hey all... i figured it out...
i got it working now...
.. thank you all for your help.
g _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Aug 10, 2009 2:56 pm |
|
|
Wayne_ wrote: | Hyperterminal is proberbly set to send \r\n (<cr><nl>) when you press enter. |
As Wayne mentions NL, I thought I would just toss in that is NewLine (not an abbrev for NULL)
As a refresher (dealing with another project sensitive to CR/LF - LF/CR position) I looked 'em up again. (I used to know this by heart, but my days of RS232 are smeared with too many other days of non-RS232.
\n is a LF in terminals. (Not a Null)
CR = 0x0D
LF = 0x0A (which is now also referred to as NEW LINE or NL)
Cheers,
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Mon Aug 10, 2009 4:05 pm |
|
|
ben & wayne..
Siow worked charms...
using the ascii and hex view i was able to get my program reading
and sending the right messages...
all the line feeds and returns... like you said ben: 0x0d and 0x0a
they show up clearly...
wayne.. great sugestion... as of now.. hyperterminal sucks hahahah
but i think all of you knew that hahahahaha
i did check hyperterminal to see if it was sending a newline or a return automatically like you sugested but it wasent... i had the right settings
i think with siow i wont run into any more issues regarding what characters i am recieving or sending...
thanks
g _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Aug 10, 2009 5:05 pm |
|
|
Find and download PuTTY if you like.
Telnet, SSH and Serial Support. I use it regularly cause it has a small install footprint.
There's also RealTerm which has some great debugging capabilities.
Get both. (free)
you'll wonder why you ever messed with Hyper (I call Spaztic) Term.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
koirnaos
Joined: 23 Dec 2009 Posts: 6
|
|
Posted: Thu Sep 02, 2010 5:11 pm |
|
|
well guys I'm confused!
When I'm sending the AT command to the modem.
Siow shows the following:
ASCII window:
\0A0D
\0AOK\0D
hex window:
41 54 0D
0D
0A
4F4B0D
0A
which part is the response? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Sep 02, 2010 5:21 pm |
|
|
For simple modem questions like this, you should use Google.
Quote: | modem AT commands and result codes |
Example of result:
http://www.developershome.com/sms/resultCodes.asp
For general programming and hardware questions, use Google rather
than depending upon us. |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Fri Sep 03, 2010 9:20 am |
|
|
although i agree with PCM, ill help you out a bit, i got some free time.
Quote: | ASCII window:
\0A0D
\0AOK\0D
hex window:
41 54 0D
0D
0A
4F4B0D
0A |
\0A0D are the new line and return hex values.... basically "put in a blank line before printing anything"
then:
\0AOK\0D "on a new line print "ok", return "
OK is your response,
and it means precisly that... "ok"
on the AT command description of your modem there should be a description of input output responses....
like PCM said... google. _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
|