All AT commands report ERROR

Hi

I have a very weird problem: After we’ve connected our modems to a PLC from a certain manufacturer, our modems stop working. If we remove the modems and connect them to our PC afterwards, all AT commands, except “AT” gives ERROR.

Not even at+cfun=1 works.

What can be the cause of this?? The only way we can bring them back to life is by downloading new firmware with DwlWin.

Hiya,

See if you can ‘sniff’ the serial data between the modem and the PLC to see what the PLC is sending to the modem. The PLC may be sending a certain initialisation string to the modem that the modem doesn’t understand, or puts the modem in the ‘broken’ state that you are seeing.

ciao, Dave

Are these PLCs supposed to support connection to a modem?

Try AT+WAC

Rudolf Ladyzhenskii
SymStream

So you’re assuming that the problem is due to an SMS, SS, or PLMN selection issue?

Yes it is supposed to work with a modem. We haven’t solved the problem yet. However we now know that it has something to do with the fact that the PLC tries to activate a GPRS session with +CGDATA.

I can also add that when this problem occurs, we can get the modem to respond with +CME ERROR: 536 which indicates that a class is locked?

It sounds to me like the modem is locked in some kind of data mode from which we cannot recover. Sometimes i have succeeded in getting control over the modem again if i repeatedly writes at&f, atz and +++, but this doesn’t always work and then we need to re-flash the modem with new firmware.

But is it specifically meant to work with your specific Wavecom modem?

Note that the Q series wouldn’t normally be considered “modems” - they are modules, and require additional hardware to form a full “modem”.

What, exactly, are you using?

Sounds like the PLC is try to set some inappropriate configuration.
Can you log the comms between the PLC and the modem to see exactly what’s happening?

Can you log the comms between the PLC and a specifically supported modem, and then try those commands manually with the Wavecom device?

It is supposed to work with any standard AT compatible modem.

We’re using the Q2687G modules embedded in our own application to form a modem with a full 9-pin rs232 connection.

We’ve tried that but haven’t seen anything unusual. It reads the CREG state to see if the modem is registered on the network.

Then it reads the CSQ level.

And finally it sets SMS in PDU mode with CMGF and reads any available messages with CMGL.

However i have not been able to figure out how to trigger an alarm on the PLC yet, which should activate the GPRS features, which are the ones probaly causing the trouble. Like i said earlier, the modem is locked in some weird state where only at+cfun, atv1, atz, gprs commands and our own OpenAT commands work. You can’t even write AT, which will just return error.

Sometimes i need to re-flash, other times i can get it out of this weird state by sending “+++”.

If an alarm occours, the PLC wants to activate a PPP connection through the modem via GPRS and delver some data to a centralized server station. It is this feature that is causing the trouble.

New information:

It seems like it was not +++ or any other command that i tried that suddenly got the modem out of this weird state! The modem is waiting on some time-out. If you let the modem take care of it self for some time, around 20 - 30 minutes without a network connection, then it suddenly works again. When this happens, it will also work again after a restart and the problem has disappeared into thin air.

Hiya,

t is causing the trouble.
[/quote]
I’m wondering if the PLC is not completing the PPP connection when using the AT+CGDATA? This would leave the modem in data mode, sort of half connected to the network, attempting to pass through PPP data to the PLC. And I very much doubt that AT is part of a valid PPP stream…

Can you manually establish a PPP connection using AT commands and see if that’s what the PLC is doing? I really think you’re going to have to sniff the connection between the PLC and Modem to track this down completely.

Also, don’t forget that the +++ sequence has to be bounded by the appropriate guard time of no data before it’s recognized as the data mode escape sequence.

The long timeout may be the network forcing a disconnect of the modem.

Just my 2cents worth.

ciao, Dave

I’ve also seen this from time to time on some of my modules, but normally.a at+cfun=1 command gets it out of this state. One way to replicate this state is if you start dwdl and then break out of it before the downoad started. I resume there are other conditions that can also get it into this state.

We are now investigating this issue again, which has been on standby until now. We are still experiencing this problem. Here is a complete log:

ATE0V0{0D}ATI{0D}AT+CREG?{0D}AT+CREG=0{0D}AT+CREG?{0D}AT+CSQ{0D}AT+CREG?{0D}AT+CSQ{0D}ATDT40210848{0D}AT+CREG?{0D}AT+CSQ{0D}ATDT40210848{0D}AT+CREG?{0D}AT+CSQ{0D}ATDT40210848{0D}AT+CMGF=0{0D}AT+CMGL=4{0D}AT+CREG?{0D}AT+CSQ{0D}AT+CMGF=0{0D}AT+CMGL=4{0D}AT+CMGF=0{0D}AT+CMGL=4{0D}AT{0D}AT{0D}AT{0D}AT{0D}AT{0D}AT{0D}ýüýðððïïï{00}ò{00}ò{00}òAT{0D}AT{0D}AT{0D}{06}{06}fæ€{06}{06}fæ€{06}{06}fæ€xxxxø{00}xxxxø{00}xxxxø{00}€{00}€{00}€€€€€{00}€{00}€{00}€€€€€{00}€{00}€{00}€€€€€{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}{00}

As you can see, the PLC sends a lot of “garbage” in between the AT commands. After this our modem will be locked and responds +CME ERROR 536 to all at commands, even if we remove power and restart.

If the PLC is designed for connection to a modem, then I think that constitutes a fault in the PLC?

Strictly, I guess, the modem should ignore stuff that does not constitute a valid AT command - but I think there must be a very high risk that this “garbage” might just happen to contain the sequence “AT…”

What does that mean?

Oh dear!!

Looks a bit like a stack overflow problem I have had. I’m no expert but read that these machines have a problem with re-allocating memory. Constantly running AT+csq/+creg commands can use up memory which is not re-allocated.
So use adl_atCmdSend sparingly

Another way out is;

AT+WDWL
then
AT+CFUN=1 will work

Pretty uncool but works

I don’t think that’s true as such.

But the AT Command interface is strictly command-response - so you should not send another command before the previous one has finished.

Looks like the PLC here may be simply spewing commands without awaiting responses?

And, as noted earlier, if the “garbage” happens to contain an ‘A’ followed by a ‘T’, that could easily gone bad…

Hello AWNeil,
I understand running AT commands using adl_atCmdSend contributes consumption of dynamic memory ( therefore Memory leak) and with no garbage collector potential memory problems after a long period?

New info:

I can now get the modem to do this even without the “garbage data”. This problem appears sometimes when the PLC issues the ATDT command and the receiving number doesn’t support data calls. After this sometimes it still works, but locks up after a restart. Other times is locks up just after the call has failed.

Please note, all this happens with or without my OpenAT application running.

I also found out that i can get it out of this “mode” if i issue a new ATDT call to a number that actually supports data calls! ATD(T) and AT+CSQ are some of the few commands which do not report CME ERROR 536.

Can you reproduce that with, say, Hyperterminal?

So what does that code actually mean :question:

I ask the same question :wink: The description for error 536 is too cryptic for me to understand:

Class locked: a command has been launched from a port, the effect is to lock all commands belonging to the same class. If another port launches a command of this class, this error will occur as long as the class is not released (at first command’s completion time)

What is a “class” in this context?? And why are all commands (with a few exceptions) “locked”??

As i read it, it locks all commands because it waits for the ATDT command to finish, yes? But then i don’t understand why this “lock” is stored over a cold reset?