Command AT and CUSD result - asterisk

I send USSD command with AT.
Sometimes I receive the response CUSD=4 sometimes it works for the same input.
The error always appends at the beginning of a new USSD session (#xxx#).
Do you know what exactly means this response? The description of the error is operation not supported.
Is-this message due to the modem or to the network?
How can I avoid it?

Such message mean you(or soft) issues AT+CUSD command
Any response except 0,1 are errors.
Exact error have follow message. Try enable debug to see full message.
Code 4 can mean different things depend of modem used, for more info you need check AT commands for modem you have.

Related

At command Communication between Verifone Nurit8320 and siemens MC55 external modem

I am communicating with a server from Verifone Nurit8320(DTE) via siemens MC55 gsm modem(DCE).
I am passing AT commands via UART to give commands to siemens MC55 gsm modem (DCE).
I have given a delay of 100 ms (required) between every AT command and I am flushing the UART of DTE before sending any command on it.
Now the problem is this
In many cases DCE is responding with the response of the previously executed AT command. The DCE UART is never flushed.
Where can I get the set of AT commands so that I can flush the UART buffer of DCE?
The problem you are trying to solve (flushing the DCE UART) is the wrong problem to focus on, because it is a problem that does not exist in AT command communication.
After sending an AT command to the DCE you MUST read every single character sent back as response from the DCE, and parse the text until you have received a Final Result Code (e.g. OK, ERROR and a few more) before you can send the next AT command. Any other way is doomed to bring in an endless list of problems and will never, never, ever work reliably.
See this answer for a general outline of how your AT command sending/parsing should
look like. Using a fixed time delay should never be done; it will either abort the command or in best case waste time while waiting unnecessarily long while never removing the risk of aborting despite of waiting. See this answer for more information about abortion of AT commands.

Is it possible a client receives half of the message following another whole message?

If I have a message protocol over TCP that looks like "|SIZE|TYPE|DATA" can my read buffer (in fact my data stream) look like this (due an error):
|SIZE|TYPE|DATA|SIZE|TYPE|PARTIAL DATA|SIZE|TYPE|DATA
This would cause I read bytes from 3. message into 2. Can this happen and how to detect such situation?
EDIT: With "partial data" I mean that the rest of that message is lost and will never get received. Another whole message is sent after that message and it finds its way to the receiver. However, because my 2. message is not full I will read a part of 3. message into my 2. message. :(
Yes it can happen that you don't read an entire message. There are no messages in TCP, it is just a byte stream. The recv() method tells you how many bytes it received.
Re your edit, nothing is lost in TCP.
You can add some control data to you message structure while you debugging you code (e.g. CRC16/32 or MD5 calculated over your data) and check it in received messages to detect errors.
You can store dump of your traffic with Wireshark or tcpdump. In the dump you will see the data stream. If you data in the stream has no error but you get a "partial" message, the error is in the receiving code, otherwise it's in the sending code.

Is there a reply to AT+GCAP & co. to tell "I'm not a modem, go away"?

I'm working on the firmware of a device that is going to be connected to PCs using Bluetooth in serial port emulation mode.
During testing, I found out that modem-manager on Linux "helpfully" tries to detect it as a modem, sending the AT+GCAP command; to this, currently my device replies with something like INVALIDCMD AT+GCAP. That is the correct response for my protocol, but obviously isn't an AT reply, so modem-manager isn't satisfied and tries again with AT+GCAP and other modem-related stuff.
Now, I found some workarounds for modem-manager (see here and thus here, in particular the udev rule method), but:
they are not extremely robust (I have to make a custom udev rule that may break if we change the Bluetooth module);
I fear that not only modem-manager, but similar software/OS features (e.g. on Windows or OS X) may give me similar annoyances.
Also, having full control over the firmware, I can add a special case for AT+GCAP and similar stuff; so, coming to my question:
Is there a standard/safe reply to AT+GCAP and other similar modem-probing queries to tell "I'm not a modem, go away and leave me alone?"
(making an answer out of the comments)
In order to indicate I do not understand any AT commands at all (aka I am not a modem) the correct response to any received AT commands should be silence.
In order to indicate I do not understand this particular AT command the correct response should be ERROR.
Anything between will trigger implementation defined behaviour of the entity sending AT commands. Some will possibly give up right away while modem-manager apparently is set on retrying sending the command until it gets a "proper" response.

error +HTTPACTION:0,601,0

I m trying to access a website using sim900 GSM module.
This is the list of commands
AT+CSQ
+CSQ: 16,0
OK
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","www.google.com"
OK
AT+HTTPACTION=0
OK
+HTTPACTION:0,601,0
AT+HTTPACTION=0
OK
+HTTPACTION:0,601,0
Unable to access google. 601 code shows Network error.
How to get rid of this error?
You need to setup the connection to the bearer. Here are the minimum setup commands that have worked for me (based on trial/error and searching around on the internet).
AT+SAPBR=3,1,"APN","wap.cingular"
AT+SAPBR=1,1
The correct value for the APN may be different for you, depending on your network and service provider. I'm using AT&T prepaid SIM cards. Once that's working, then you can do the HTTP setup commands as you already have...
AT+HTTPINIT
AT+HTTPPARA="URL","http://www.google.com"
AT+HTTPACTION=0
Status codes above 600 (and some in the 500 range) are unassigned in the HTTP standard. In the AT command manual for the SIM908, status meanings are given in the notes on the HTTPACTION command:
600 Not HTTP PDU
601 Network Error
602 No memory
603 DNS Error
604 Stack Busy
You can query the bearer connection status of CID 1 with AT+SAPBR=2,1 and the related parameters with AT+SAPBR=4,1. You can also check that you're attached to the GPRS network with AT+CGATT?. If everything indicates that you are connected and you are still getting a 601 status code, then check that your service plan has data and that it hasn't run out. I have found that even when my account has a few hundred k of data showing on the balance that I start to get a 601 status until I add more data to my prepaid phone plan. If the SIM module has been on the whole time and you add more data, you'll need to close and re-open your connection (AT+SAPBR=0,1 followed by AT+SAPBR=1,1) and then your HTTP* commands will start working again without having to set the HTTPPARA settings again and without having to restart with HTTPINIT.
I have found that when an http call is made to an https only website it will throw a 601 error on the sim. Beware some sim devices have ssl and some don't. Use AT+HTTPSSL=? to interrogate. device with ssl will respond like, 'HTTPSSL 1'. If you get an error your device doesn't have ssl. This took some work with the factory for me to determine this.
You must also use to hit ssl site. I am using the wifi101 ssl client.
fona.setHTTPSRedirect(true);
dy3
I have encoutered this error as well. The cause of the problem may be that there is not enough money in the phone number account. You may check it.
601 is some custom implemented Error code.
Here is the list of standard HTTP Status codes
+HTTPACTION:0,601,0
The above AT response code (601) for HTTP session start indicates that
there is a network error. Then make sure that the PDP context is setup
properly.
source
https://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/
I have spent many hours with this module right now.
My experience is that when you dont get a 200 reply from remote server, you should check IP address to verify you are still on the network sendng a ping to a working server (AT+CIPPING="XX.XX.XX.XX").
If it succeeds: Try AT+SAPBR=2,1 and AT+CIFSR. You should get same address for both commands.
If you dont get same address, login again to the netword/service with AT+CIPCSGP=1, "yourapn.com", "user", "password".
If nothing works, power down the module. Wait a couple of minutes, and restart again.
Just in case someone is affected by this problem and stumbles on this post 4 years later: in my case the module had a small "sticker" type antenna and it got somehow damaged.
I could connect to the network but when I tried to use HTTP over the GPRS networks I only got return code 601 (network error) or 603 (failed to resolve DNS).
Once I replaced the antenna with a new one, everything worked perfectly.
Again, in case somebody has the same problem. In my case it was a typo in url:
AT+HTTPPARA="URL"," http://www.google.com"
Did you notice the space before http? For several hours, I didn't notice it too.
Usually after this command AT+SAPBR=3,1,"CONTYPE","GPRS" you enter your "APN", "USR" & "PWD" details also using SAPBR=3,1 etc. These details must match the SIM card / mobile phone provider.
Then it is recommended to check that your device has now received an IP address. Sometimes this is not straight away. Use AT+SAPBR=2,1 to query and this will return your IP address which you should check for confirmation.
Once you have IP address you can enter AT+HTTPINIT, AT+HTTPPARA="CID",1 etc.
Now to use GET you have to include a "?" after the URL to provide your php script with a key=value pairing.
Thus in your case it is something like, AT+HTTPPARA="URL","http://<Public_Ip_Address>:8080/folder/savedata.php?A=1001" where A is the key and 1001 is the value.
Now send the AT+HTTPACTION=0 and you should get a +HTTPACTION: 0,200,1000 response where 200 is the OK and 1000 is the payload size. AT+HTTPREAD will allow you to read the response if it is required.
Change URL. 601 is a URL has been moved. Is a redirect.

stty and sending carriage return

I have a serial device with which I am trying to communicate. This device knows when a complete command has been sent when the command string is terminated with a "\r". Thus, a typical command string might be something like "COMMAND \r".
I'm having trouble configuring stty in such a way that the carriage return gets sent to the device. Currently, the device will not respond to any of my commands, so it's as if the input to the device is still "hanging."
I've written some simple C code where I bypass the terminal and there I can successfully elicit replies from the device, which is the reason why I think that the commands are not being properly terminated in the terminal. I've tried many different permutations of -+onlcr, +icanon, etc to no avail. The baudrate, parity, data bits, start and stop bits are all properly configured, as far as I can tell.
How can I debug this issue?
What is the platform (machine)? What is the OS?
Have you tried to flush the output with
fflush( FILE * FP );
Tried COMMAND\r\n ? What's the device?

Resources