RE: [bascom] troubles with GSM modem
Hi
I found that I needed a diffrent cable to PC han on the STK500.
Georg
-----Original Message-----
From: owner-bascom@grote.net [mailto:owner-bascom@grote.net]On Behalf Of
Mike Cook
Sent: 16 January 2005 05:13 PM
To: bascom@grote.net
Subject: RE: [bascom] troubles with GSM modem
Thomas,
Take a look at this web page: http://www.allsurplus.net/bascom-avr/ download
the "Code to communicate with the Enfora MT-G GSM/GPRS Modem".
I wrote this to test several AT Commands on an Enfora L.P. GSM/GPRS modem.
Since I work the company that manufactures this modem, it's my job to test
the embedded firmware for "Lock-Ups". This code was used to keep the modem
busy while monitoring our embedded firmware for any strange behavior.
You might be able to use some of this code in your project to communicate
with your GSM modem.
Hope some of this mess helps!
Mike Cook
-----Original Message-----
From: owner-bascom@grote.net [mailto:owner-bascom@grote.net]On Behalf Of
Thomas Bulckaert
Sent: Sunday, January 16, 2005 6:37 AM
To: bascom@grote.net
Subject: Re: [bascom] troubles with GSM modem
Hi Everyone
I am still having the problem with my gsm-modem. I found out some things.
When i control the modem via hyperterminal with my pc, i have seen, that the
modem only sends a reaction, when i received an 'enter', so i type: "AT"
enter. Then i get "OK". But when i follow the example code from SMS.bas.
There is "enter" sent after the AT-commands. So the modem never answers, or
even reacts to the command. When i send the pin-code, it doesn't arrive in
the modem. because it waits for the 'enter'. However. I've tried:
print "AT" ; chr(13)
Chr(13) is carriage return.
This doesn't change much, unless the length of the string i've sent
But there is still no answer from the modem.
Then i tried to do a carriage return, line feed
print "AT" ; chr(13); chr(10)
This doesn't change anything either.
I saw on my scope that the modem only answers when (if i control it with
hyperterminal) it press enter on my keyboard.
anyone has experience with this?
What am i doing wrong?
Thanks in advance
Thomas Bulckaert
----- Original Message -----
From: ian dobson
To: bascom@grote.net
Sent: Friday, January 14, 2005 11:06 PM
Subject: Re: [bascom] troubles with GSM modem
Hi Thomas,
What do you get if you send an atz to the phone? I would try using a longer
delay after sending each command before you try to read data back.
I wrote something in VB a while back that talked to a phone over the rs232
port and I had to include a delay of atleast 200ms between each command,
before it worked as expected.
Regards
Ian Dobson
----- Original Message -----
From: Thomas Bulckaert
To: bascom@grote.net
Sent: Friday, January 14, 2005 9:31 PM
Subject: [bascom] troubles with GSM modem
Hi everyone.
I bought a GSM-modem from MCSELEC. I use the sampel file sms.bas to get
started.
When i hook up the modem to my pc and control it via hyperterminal, i am
able to send an sms. However, i have not yet been able to do the same when i
control it with my ATmega64. The problem has something to do with echo, i
think. I use the sample code. I just adapted the code for my clock and
controller. Some things just don't work correct in that sample. I'll add it
here in pieces and give my experience in bold text.
$regfile = "M64def.dat"
'XTAL = 1 MHZ
$crystal = 1000000
'By default the modem works at 9600 baud
$baud = 9600
'HW stack 20, SW stack 8 , frame 10
'some subroutines
Declare Sub Getline(s As String)
Declare Sub Flushbuf()
Declare Sub Showsms(s As String )
'used variables
Dim I As Byte , B As Byte
Dim Sret As String * 66 , Stemp As String * 6
'config 2x16 lcd
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 =
Portc.7 , E = Portd.6 , Rs = Portd.4
Config Lcd = 16 * 2
'we use a serial input buffer
Config Serialin = Buffered , Size = 12 ' buffer is
small a bigger chip would allow a bigger buffer
'enable the interrupts because the serial input buffer works interrupts
driven
Enable Interrupts
Const Senddemo = 1 ' 1= send an sms
Const Pincode = "AT+CPIN=1234" ' pincode change
it into yours!
Const Phonenumber = "AT+CMGS=+31653123456" ' phonenumber to
send sms to
Cls
Lcd "SMS Demo"
'wait until the mode is ready after power up
Waitms 3000
Lcd "Init modem"
SO FAR SO GOOD
Print "AT" ' send AT
command twice to activate the modem
Print "AT"
Flushbuf ' flush the
buffer
Print "ATE0"
Home Lower
Do
Print "AT" : ' Waitms 100
Getline Sret ' get data from
modem
#if Uselcd = 1
Lcd Sret ' feedback on
display
#endif
Loop Until Sret = "OK" ' modem must
send OK
Flushbuf ' flush the
input buffer
THE DO-LOOP KEEPS ON SHOWING "AT"'s on my LCD ( if i don't remove the loop)
it never exits it.
Home Upper : Lcd "Get pin mode"
Print "AT+cpin?" ' get pin status
Getline Sret
Home Lower : Lcd Sret
MY LCD shows : "AT+cpin?". This is the at-command i gave. This should be:
"+CPIN: SIM PIN" , the reaction of the modem.
If Sret = "+CPIN: SIM PIN" Then
Print Pincode ' send pincode
End If
Flushbuf
The pincode will never be sent, since Sret is not the thing you would expect
it to be. When i do the same in hyperterminal, this works just fine.
The rest of the code is irrelevant for the moment, since i have to get the
pincode in the device before it is useful to me.
Can anybody see the problem i am having?
Thanks in advance
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005