Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 04, 2016, 09:22:18 21:22


Login with username, password and session length


Pages: [1]
Print
Author Topic: [help] SIM900D and AT+CUSD Command  (Read 8244 times)
0 Members and 1 Guest are viewing this topic.
Rafa
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 21
-Receive: 21


« on: April 01, 2014, 03:03:05 15:03 »

Hello,

Working with built in SIM900D and trying to get the credit balance using the AT+CUSD command.

I tried the test command: "AT+CUSD=?" and it gave back the expected OK.
The same with the read command: "AT+CUSD?" and i got the correct answer depending on the 'n' parameter.

I can receive and send SMS, all working. No problem with that.

Now as on the manual the sintax to check the balance should be: AT+CUSD=1,"*544#",15
all included between quotation marks, so:
"AT+CUSD=1,"*544#",15"

I tested with:
"AT+CUSD=1,"*544#",15"
"AT+CUSD=1,"*544#",0"
"AT+CUSD=1,"*544#",1"
"AT+CUSD=1,"*544#""
All gave OK as responce from the module.

When i send the request i just get OK back, with no further info. The message including the credit balance doesn't arrive.
That OK is just the module confirming the execution of the code. And if i understood well, after that should arrive the credit balance message.

I've read that first need to put the message format to PDU (AT+CMGF=0) but it does not make sense as the module send back OK after execute the command in text format.
And nothing is related to that on the manual. Other commands as, check signal quality, work without the need of PDU mode.

*544# works because i tested it with cel fone and it gave the credit balance back.

So how i catch the credit balance message? I've made a loop waiting for incoming message, but it didn't work.
Do i need to use other AT command? Because i have read a lot of pages abaut and i doesn't seems like that something is wrong.
The trick is how to get that credit balance message to display it?

Any help is very appreciated!
Thanks in advance!
Logged
chandra2sekhar2000
Active Member
***
Offline Offline

Posts: 121

Thank You
-Given: 22
-Receive: 17


« Reply #1 on: April 02, 2014, 09:46:43 09:46 »

Hi
when u want  to know the credit balance, u have to set the At+cusd=1,then dial using ATDxxxxx(*544#) etc,then after 3 to 5 sec u will get the msg.later u have to off the ussd info using AT+CUSD=0. else it will create problem with unneccesary msgs from network.
Logged
Rafa
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 21
-Receive: 21


« Reply #2 on: April 02, 2014, 01:55:07 13:55 »

Dear chandra,

According to GSM 02.90 standart, the write command is: AT+CUSD=[<n>[,<str>]]

Where 'n' stands for:
0 disable the result code presentation in the TA
1 enable the result code presentation in the TA
2 cancel session (not applicable to read command response)

So using the AT+CUSD=1 just set the parameter 'n' on TA and it doesn't ask the network.

'str' stands for: string type USSD-string (when  parameter is not given, network is not interrogated). In my case it need to be *544# to ask the network provider.

First set the presentation result itself doesn't have meaning because, enable the result code is part of the write command. And the write command without the string does nothing.
In addition, value 'n'=2 is used to cancel an ongoing USSD session.

I'm receiving ok after send the command, but this is not the network response, and even if it shoul be incorrect the answer should be like this:

 +CUSD: 0,"The service you requested is currently not available.",15

If the transaction is correct it should looks like:

Send AT command: AT+CUSD=1,“*544#” 
(Enable the Result Code presentation in the TAE and send a USSD-request)

Response from net provider: +CUSD:1,“id code” OK
(Further user action required, give id code)

Send AT command: AT+CUSD=1,“7465338”
(Id code given)

Response from net provider: +CUSD:0 OK
(No further user action required)

"then dial using ATDxxxxx(*544#) etc"
There is no need to dial, USSD is related to network provider directly.
Or could you be more especific at ATDxxxxx?

"then after 3 to 5 sec u will get the msg"
Ok but how do i catch that message? Cause it's not sms type, and a ussd message does not arrive on my sim card.

Thank you.
Logged
Rafa
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 21
-Receive: 21


« Reply #3 on: April 02, 2014, 08:51:07 20:51 »

After a hundred of tries i'll report, maybe it's usefull to someone.

I've read that should set message to PDU format before send the at+cusd request.
So i gave a try to it. On that way the sim900d stoped to respond. No ok or error back.

After more web pages diggin i found that the cusd str should be translated to PDU format and then send it.

Text format: *544#
PDU format: 00110000910000AA05AA1A8D3602

Then i send via at+cusd that PDU format and it gave back just ok as the text format.
I tried with 7, 8 and 16 alphabet bits an get always the same ok back.

So there is other way to got the credit balance or it work for some networks and not for anothers.

I'm givin up for now, any usefull input,  are welcome. There are no more options to try.
If someone wants to translate txt to pdu can use this page.

http://www.smartposition.nl/resources/sms_pdu.html


Logged
chandra2sekhar2000
Active Member
***
Offline Offline

Posts: 121

Thank You
-Given: 22
-Receive: 17


« Reply #4 on: April 03, 2014, 11:37:21 11:37 »

Hello,
i dont know what u have tried so many times..long back i also stuggled to get credit balance info..based on the my learning i have given u the answer.no need of pdu mode ..just set the normal text mode.just enter the following commands in sequence and let me know the result.

AT+CMGF=1
AT+CUSD=1
ATD*544#
first u will get 'OK' reponse.after few seconds u will get +cusd: reply.if possible soon i will send u a hyper terminal snap.
Logged
Rafa
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 21
-Receive: 21


« Reply #5 on: April 03, 2014, 02:29:18 14:29 »

Hello chandra,

well, all the above i've posted is what i found searching over web pages about credit balance. I've read a lot because the manual of sim900d is poor and the info are very basic for the commands. All search that i made point me to the direction of the posts i made before. Your info is on a very diferent way and i will give it a go soon as i can. After that i'll come back to comment the results.
Your help is very appreciated, thank you.

---edit---

here again,

I did exact as you asked, and just got ok back, one after other. i didn't send CMGF cause it was already in text mode.
send: AT+CUSD=1, response: ok
send: ATD*544#, response: ok and nothing more.
sorry, it's not working for me.  Embarrassed

question 1: on your first reply you said "dial" using ATD, i send the commands as string command, didn't dialed the ATD command. did i misunderstood?

q 2: there is more than one ATD command, if you want take a look just google: SIM900_AT Command Manual_V1.03 (pdf)

page 18: 2.2.3 ATD Mobile Originated Call to Dial a Number
page 20: 2.2.4 ATD <n>
page 21: 2.2.5 ATD <str>

i don't know the correct one, so i just did as you asked.

please take note, i'm working on a stand alone hardware with sim900d chip, it's not a manufactured modem.

thank you for your time!




« Last Edit: April 03, 2014, 09:19:36 21:19 by Rafa » Logged
chandra2sekhar2000
Active Member
***
Offline Offline

Posts: 121

Thank You
-Given: 22
-Receive: 17


« Reply #6 on: April 04, 2014, 12:23:05 12:23 »

Hello
i dont what u meant by standalone chip. will it connects with hyperterminal.if so check the below snapshot.i also used same Sim900D chip connected to PC from serial port.
just entered the following
AT+CUSD=1 to enable unsolicicated msgs from network.
ATD*121#  to check balance.....check whether your code *544# works with that network.or try some other network sim....first check in your phone....then use that sim card...in sim900d...for your confirmation.

Logged
Rafa
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 21
-Receive: 21


« Reply #7 on: April 04, 2014, 02:06:25 14:06 »

Hi,

with "standalone hardware with sim900d" i want say that this is not a common moden. i can't connect with pc through serial port.
it's a harware that uses gsm to control digital inputs and outputs with relays. so i need to hardcode the comands on a pic chip.
to interact with it, i send sms from my personal phone and ask the desired tasks.
so when i ask for 'credit', the hardware set and send the command and give me a result sms back.
the same way when i ask for signal quality, and it works fine.

and i've tested the *544# with my phone and it works well. but a didn't manage to get it working with that hardware i bought.

thank you!
« Last Edit: April 07, 2014, 07:01:02 19:01 by Rafa » Logged
chandra2sekhar2000
Active Member
***
Offline Offline

Posts: 121

Thank You
-Given: 22
-Receive: 17


« Reply #8 on: April 04, 2014, 07:37:21 19:37 »

Hi,
operational wise there is no difference between a PC modem or standalone.what ever it may be...the commands same....if u want to check it just,temporarly cut the RX & TX lines of modem,use a max232 level converter and check it in PC.then u can do the same using PIC.

i alrdy worked with AVR ,PIC & GSM based products.usally the other commands outputs data in a known format.where as the balance enquiry format differs in length from network to network...roughly i will tell u the process..try to follow it..


Uart recieve:
--->valid SMS-->command to query balance--->send AT+CUSD=1 ATD*544#
-->+CUSD: command received from UART.then copy the entire string.--->then send SMS(the copied string)..
come out of loop


i did it in same way...if u find difficulty in understanding..send your code...i will try to add neccesary changes..if possible.see u
Logged
Rafa
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 21
-Receive: 21


« Reply #9 on: April 07, 2014, 07:00:43 19:00 »

Thank you for your offer,

but I don't need help to manage the code itself. The problem is the concept behind the request of the credit and the AT correct command.

As I told you there are many to the most of all, pages refering to the CUSD command. Your info about the ATD was new and even so I just found a little about it in web. And it gave just the 'ok' back too.

As I can send and receive SMS, and get the replay of other commands request, I didn't belive that I can't do it with the credit request.

I can't remember the location where i read to end the command with ';' so i tried it that way: ATD*544#; and after this i received a blank sms.

There was no credit info or other at all, but for the fist time it was not the simple 'ok'. Now i need to dig in if there is more info to come or not. As i make progress will tell you.

Thanks!
Logged
sakbal
V.I.P
Newbie
*****
Offline Offline

Posts: 9

Thank You
-Given: 122
-Receive: 35


« Reply #10 on: April 08, 2014, 08:15:16 08:15 »

Been using this on SIM900 for  few years now in South Africa / Vodafone network

'USING USSD

'AT+CUSD=1,"*100#"
'OK
'+CUSD: 0,"Your account is 67.25",68
'

Works every time down here.
Hope it helps
Logged
Rafa
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 21
-Receive: 21


« Reply #11 on: April 08, 2014, 04:08:41 16:08 »

Hi,

thanks sakbal, for letting me know. If you read my first post, i tried that way but without success. For my network it should be:
AT+CUSD= 1,"*544#" but i just catch the first ok as answer.
Logged
Ichan
Hero Member
*****
Offline Offline

Posts: 840

Thank You
-Given: 312
-Receive: 387



WWW
« Reply #12 on: April 09, 2014, 03:22:07 15:22 »

I will try to:

- use other provider
- replace the SIM900 firmware
- use other gsm module

Trial and error is the best engineering method..  Grin

-ichan
Logged

There is Gray, not only Black or White.
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC