CMS Error 321 is not an error. It is a way for the modem to say "there are
no messages available"
The current Java code is correctly handling the situation where the modem
answers OK or ERROR
if (line.length() <= 0 || line.equalsIgnoreCase("OK")) break;
if (line.length() <= 0 || line.equalsIgnoreCase("ERROR")) break;
There should be a similar line to handle the cms error
if (line.length() <= 0 || line.matches("\\+CM[ES]\\sERROR:\\s\\d+")) break;
regards
wim stevens
On Thursday, July 11, 2013 11:22:56 AM UTC+2, Brian Dooleweerdt Rasmussen
wrote:
>
> Hi,
>
> a short follow up on my question.
>
> I never looked into the root of the problem, so I don't know the answer to
> my questions above. Never got any info from Telit either.
>
> I have fixed this with a minor modification to the "Comm2IP" module. It
> now searches for the "CMS ERROR" message in the modem response. If it finds
> it, the PC will reboot (it fires the shutdown command). This has kept the
> system running for weeks and it doesn't matter if the PC reboots in case of
> modem errors.
>
> Hope this can be helpful for someone.
>
> Best regards
> Brian
>
> Den torsdag den 20. juni 2013 14.21.17 UTC+2 skrev Brian Dooleweerdt
> Rasmussen:
>>
>> Hi,
>>
>> yes I believe you are right, the CMS ERROR: 321 is a real modem error. I
>> will try to get info from Telit, why this error is thrown.
>>
>> From other threads regarding CMS ERROR: 321, it also looks like the
>> modemGateway.java throws an exception, due to incorrect string format of
>> the CMGL answer ("CMS ERROR: 321" is not a PDU message). At the moment I
>> can't tell if my application does the same, but I guess I have to
>> investigate this further too...
>>
>> I will try to disable the CMTI messages.
>>
>> Thanks for your reply.
>>
>> /Brian
>>
>>
>> Den torsdag den 20. juni 2013 08.48.44 UTC+2 skrev Thanasis Delenikas:
>>>
>>> Hi,
>>>
>>> What I see from the commands/logs you've pasted is that the CMGL command
>>> sometimes returns the list of messages (correct behavior) but at some point
>>> it returns a CMS 321.
>>>
>>> Is this correct?
>>> If this is true, the error gets thrown before the message processing -
>>> so, I am not very sure that clearing up the memory would fix this.
>>>
>>> You could try to disable the receive indications (those CMTI what I see
>>> popping here and there) and see how it goes...
>>>
>>>
>>> On 19 June 2013 11:07, Brian Dooleweerdt Rasmussen via SMSLib Discussion
>>> Group <
>>> smslib+noreply-apn2wqdp_xwgmtd6k_c1ryvcmwbhmgmsijmdkuskjinl8a...@googlegroups.com
>>> > wrote:
>>>
>>>> Hi all
>>>>
>>>> I have deployed a .NET application with SMSlib 3.5.2. Now after a few
>>>> weeks tests, I have had a few hang-ups of the system.
>>>> I have now logged the modem response and all SMS handling stops after
>>>> receiving a "+CMS ERROR: 321" message. I'm using Comm2IP and a Telit 864
>>>> modem.
>>>>
>>>> Other threads here indicates it might be due to a:
>>>> java.lang.StringIndexOutOfBoundsException:
>>>> at java.lang.String.substring(Unknown Source)
>>>> at org.smslib.modem.ModemGateway.readMessagesPDU(ModemGateway.java:
>>>> 545)
>>>>
>>>> Does anyone know, how to get the communication up running again after
>>>> this error? It looks like the ModemGateway thread stops and only some kind
>>>> of keep alive messages continue (see the AT -> OK commands below in the
>>>> log).
>>>>
>>>> Do I need to delete the complete modem storage, in case of this error,
>>>> to get rid of erroneuous messages in modem memory/sim card?
>>>>
>>>> Thanks in advance
>>>>
>>>> Best regards
>>>> Brian Rasmussen
>>>>
>>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>>> - - - - - -
>>>> The modem communication looks like this:
>>>>
>>>> Comm2IP, To Modem = AT+CMGL=4
>>>>
>>>> Comm2IP, From Modem =
>>>>
>>>> Comm2IP, From Modem =
>>>> +CMGL: 1,1,"",52
>>>>
>>>> 06915404939099400A91541582567400003160616183948026050003890202CEE9717AFC1EA7C7EBF1DA9C369FED1DF1386D26AF4169B3BD236603
>>>> +CMGL: 2,0,"",158
>>>>
>>>> 06915404950000440A915432964010000031608191012380A0050003AA0301E076907E0D12CFC7E835086E07E9D720B81D249E8FD16B907E0D82DB41FA35483C1FA3D720B81DA45F83E07690783E46AF41FA35483C1FA3D720B81D249E8FD16B90783E46AF41703B68BD5EAFD7EBF57ABD0689E763F41A249E8FD16B90783E46AF41703B48BF0689E763F41A04B783F46B10DC0E12CFC7E83548BF06C1ED20FD1A249E8FD1
>>>>
>>>> OK
>>>>
>>>> Comm2IP, To Modem = AT+CPMS="SR"
>>>>
>>>> Comm2IP, From Modem =
>>>>
>>>> Comm2IP, From Modem =
>>>> +CPMS: 0,5,2,25,2,25
>>>>
>>>> OK
>>>>
>>>> Comm2IP, To Modem = AT+CMGL=4
>>>>
>>>> Comm2IP, From Modem =
>>>>
>>>> Comm2IP, From Modem =
>>>> OK
>>>>
>>>> Comm2IP, From Modem =
>>>>
>>>> Comm2IP, From Modem =
>>>> +CMTI: "SM",3
>>>>
>>>> Comm2IP, To Modem = AT
>>>>
>>>> Comm2IP, From Modem =
>>>> OK
>>>>
>>>> Comm2IP, To Modem = AT+CPMS="ME"
>>>>
>>>> Comm2IP, From Modem =
>>>>
>>>> Comm2IP, From Modem =
>>>> +CPMS: 0,50,3,25,3,25
>>>>
>>>> OK
>>>>
>>>> Comm2IP, To Modem = AT+CMGL=4
>>>>
>>>> Comm2IP, From Modem =
>>>>
>>>> Comm2IP, From Modem =
>>>> +CMTI: "SM",4
>>>>
>>>> +CMS ERROR: 321
>>>>
>>>> Comm2IP, To Modem = AT
>>>>
>>>> Comm2IP, From Modem =
>>>> OK
>>>>
>>>> Comm2IP, From Modem =
>>>>
>>>> Comm2IP, From Modem =
>>>> +CMTI: "SM",5
>>>>
>>>> Comm2IP, To Modem = AT
>>>>
>>>> Comm2IP, From Modem =
>>>>
>>>> Comm2IP, From Modem =
>>>> OK
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "SMSLib Discussion Group" group.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/smslib/ca2b1d2d-9dff-4af5-876c-eedba9b895a6%40googlegroups.com
>>>> .
>>>>
>>>>
>>>>
>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion Group" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/smslib/a3ed6445-8718-4466-ac45-3ede3537ffed%40googlegroups.com.