Cellular Phone Forum / General / GSM / June 2007
GSM Modem problems with SMS
|
|
Thread rating:  |
Tym - 19 Jun 2007 22:18 GMT I've got an app which sends and receives SMS via a USB GSM modem - works great in PDU mode
So.. methinks I'll put an old mobile on the end of the cable and try to use that instead...
Kinda works....
It will send fine, but thre are reception problems
1) - the phone grabs the MS message even though I've set it to use SM","SM" - how do I stop the phone grabbing the SMS??
2) when I do "AT+CMGL=4" - I get ERROR Why? How do I list the SMS in this instance??? in PDU mode...
I found 1 way - CMGR I think, but you have to put the index of the SMS in manually - so How do I know how many SMS there are waiting to be read?? and when how do I tell it's status?? read/unread etc... thi sis easy with CMGL, no so appaarant wiht CMGR....
Any help - advice - pointers welcome
Thanks
Tym.
John Henderson - 20 Jun 2007 00:09 GMT > I've got an app which sends and receives SMS via a USB GSM > modem - works great in PDU mode [quoted text clipped - 9 lines] > use > SM","SM" - how do I stop the phone grabbing the SMS?? How are you setting that? What do
AT+CPMS=?
and
AT+CPMS?
return when the phone is waiting for incoming SMSs?
> 2) when I do "AT+CMGL=4" - I get ERROR > Why? How do I list the SMS in this instance??? in PDU mode... "AT+CMGL=4" is PDU-mode syntax. Are you sure the phone is in PDU-mode at that time? What does
AT+CMGF?
return?
The PDU-mode syntax will generate "ERROR" if the phone is in text-mode. The equivalent text-mode parameter to the PDU-mode 4 is "ALL", /vis/
AT+CMGL="ALL"
(very often case-sensitive).
Despite the fact that GSM 07.05 requires a phone to default to PDU-mode in preference to text-mode where both are supported, I've found that some do the opposite.
> I found 1 way - CMGR I think, but you have to put the index of > the SMS in manually - so How do I know how many SMS there are > waiting to be read?? and when how do I tell it's status?? > read/unread etc... thi sis easy with CMGL, no so appaarant > wiht CMGR.... As another alternative, "AT+CNMI" can configure the delivery of incoming SMS notifications to the serial port as unsolicited "+CMTI: " results, including the particular SMSs' index.
It can also deliver the messages themselves directly to the serial port with no phone or SIM storage, as unsolicited "+CMT: " results. This might need to be used in conjunction with one or two additional commands to work properly.
John
Tym - 20 Jun 2007 06:45 GMT >> 1) - the phone grabs the MS message even though I've set it to >> use [quoted text clipped - 9 lines] > > return when the phone is waiting for incoming SMSs? Will get back to you later when I try this again,
Seem to remember ("SM","ME") , ("SM","ME"), then something else...
>> 2) when I do "AT+CMGL=4" - I get ERROR >> Why? How do I list the SMS in this instance??? in PDU mode... > > "AT+CMGL=4" is PDU-mode syntax. Are you sure the phone is in > PDU-mode at that time? What does Yes. phone will ONLY work in PDU mode in this isntance. Tet mode is not an option - i've been working intext mode with another device for 8 weeks. Now I''ve spent a week changing it to PDU mode on the same device and all is well. Now I want to use a mobile phone - all is NOT well :-)
> AT+CMGL="ALL" I know - not applicable in this case
> (very often case-sensitive). > > As another alternative, "AT+CNMI" can configure the delivery of > incoming SMS notifications to the serial port as unsolicited > "+CMTI: " results, including the particular SMSs' index. Played with CNMI yesterday but didn' get very far - I'll try CMTI today.
> It can also deliver the messages themselves directly to the > serial port with no phone or SIM storage, as unsolicited "+CMT: > " results. This might need to be used in conjunction with one > or two additional commands to work properly. 'll look into that though from my routines - this could cause a problem!
John Henderson - 20 Jun 2007 07:08 GMT > Yes. phone will ONLY work in PDU mode in this isntance. Tet > mode is not an option - i've been working intext mode with > another device for 8 weeks. Now I''ve spent a week changing it > to PDU mode on the same device and all is well. Now I want to > use a mobile phone - all is NOT well :-) OK, what does
AT+CMGL=?
return? If there's no "4" (all) in the <stat> result, you should be able to make do with what's there, like zero (received unread) and "1" (received read).
> Played with CNMI yesterday but didn' get very far - I'll try > CMTI today. Understanding the syntax of "AT+CNMI" can be tricky, but if it's supported it do some interesting things. The first step is to ask the phone what "AT+CNMI" parameters it accepts, using the query command:
AT+CNMI=?
John
Tym - 20 Jun 2007 07:34 GMT John,
Furher playing this morning:
at+cpms=? +CPMS: ("ME","SM"),("ME","SM"),("ME")
OK at+cpms? +CPMS: "SM",0,15,"SM",0,15,"ME",1,40
OK at+cnmi=? +CNMI: (3),(0,1,3),(0,2),(0),(0)
OK at+cmti=? ERROR at+cmt=? ERROR at+cmgl=? +CMGL: (0-4)
OK at+cmgl=1 OK at+cmgl=4 OK
the AT+CMGL wouldn't work yesterday!
>> Yes. phone will ONLY work in PDU mode in this isntance. Tet >> mode is not an option - i've been working intext mode with [quoted text clipped - 21 lines] > > John John Henderson - 20 Jun 2007 07:52 GMT > at+cmti=? > ERROR > at+cmt=? > ERROR "+CMTI: " and "+CMT: " are unsolicited result codes, not commands. If you've used the associated command, "AT+CNMI", to set up incoming SMS notifications to the serial port, then the serial port will get sent a "+CMTI: " result code (with details) every time an SMS is received (without you needing to enter any more commands). This is what's meant by unsolicited result codes.
> at+cmgl=? > +CMGL: (0-4) That's reassuring.
> OK > at+cmgl=1 > OK > at+cmgl=4 > OK Set the read memory to "ME" and that last command will show you the received PDU.
John
John Henderson - 20 Jun 2007 21:43 GMT > at+cnmi=? > +CNMI: (3),(0,1,3),(0,2),(0),(0) This phone's implementation of "AT+CNMI" supports unsolicited notifications to your application - either of the messsage's index with a "+CMTI: <mem>,<index>" result or a "+CMT: [<alpha>],<length><CR><LF><pdu>" result.
I'd be careful about absolute reliance on "AT+CNMI" to get new messages however, because there might be reasons why an SMS could be received and stored in <mem3> without "AT+CNMI" being active (unexpected device reset, for example). I'd always do a regular "AT+CMGL" to see if there're any new unread messages.
But if that "AT+CMGL" is done infrequently, or if the volume of incoming traffic can sometimes be high, then you could use an unsolicited +CMT: [<alpha>],<length><CR><LF><pdu> result to simply trigger your application to do an immediate "AT+CMGL".
In the case of this phone, you should be able to set up that unsolicited result notification with the
AT+CNMI=3,1,0,0,0
command.
John
John Henderson - 20 Jun 2007 21:48 GMT I wrote:
> But if that "AT+CMGL" is done infrequently, or if the volume > of incoming traffic can sometimes be high, then you could use [quoted text clipped - 5 lines] > > AT+CNMI=3,1,0,0,0 "+CMT: [<alpha>],<length><CR><LF><pdu>" above should read "+CMTI: <mem>,<index>", of course.
John
Tym - 20 Jun 2007 07:09 GMT > AT+CPMS=? = ("ME","SM"),("ME","SM"),("ME")
> AT+CPMS? = "SM",0,15,"SM",0,15,"ME",1,40
John Henderson - 20 Jun 2007 07:44 GMT >> AT+CPMS=? > > = ("ME","SM"),("ME","SM"),("ME") To my mind, that's an odd-looking result.
The third bracket is <mem3>, the prefered storage for received SMSs. And the only value this phone accepts here is "ME", which is "mobile equiment", meaning the phone's own memory rather than the SIM. That's why the phone is grabbing them.
I suggest you set <mem1> (the location your read commands will access) to "ME" address space also, and everything should work OK.
AT+CPMS="ME"
should do this. It's currently set to the SIM as per this result:
>> AT+CPMS? > > = "SM",0,15,"SM",0,15,"ME",1,40 Your phone currently has no messages stored in the SIM (SIM capacity is 15 messages). Some could have got there when the SIM was in another device, which is probably why "SM" is a supported read option.
It has one message in "ME" storage (out of a possible 40 maximum).
John
Tym - 20 Jun 2007 07:55 GMT > AT+CPMS="ME" So, when I go the AT+CMGL=4, the CPMS will force it to read from the ME??
Tym
John Henderson - 20 Jun 2007 08:09 GMT >> AT+CPMS="ME" > > So, when I go the AT+CMGL=4, the CPMS will force it to read > from the ME?? Yes, if <mem1> says "ME" on an
AT+CPMS?
command, that's where it'll be reading from. And if there are any "received unread" messages there, their status will be changed to "received read" (always a side-effect of any read).
John
Tym - 20 Jun 2007 08:17 GMT I'll give it a try in a while once I've got dressed (!) and let you know
Thanks for your time.
Tym
>>> AT+CPMS="ME" >> [quoted text clipped - 10 lines] > > John Tym - 20 Jun 2007 13:32 GMT John,
Many thanks - Looks that worked
Tym
>>> AT+CPMS="ME" >> [quoted text clipped - 10 lines] > > John
|
|
|