Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Send an AT command to a Fastrack Supreme via RS232

Status
Not open for further replies.

Annees

Newbie level 3
Joined
Jun 21, 2010
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
France
Activity points
1,316
Hello,

I work on a project based on a FASTRACK SUPREME which has to receive commands via a serial RS232. The

problem is:
When I use HyperTerm the command ATDxxxxxxxxx; works fine.
When I use the CVI RS232 library nothing happens. Is it possible that my command remains blocked in the serial buffer?
Here is my code:

#include <ansi_c.h>
#include <cvirte.h>
#include <userint.h>
#include <rs232.h>
#include <utility.h>
#include <formatio.h>
#include <string.h>

int configurePort(void);
int sendCommand(void);
int port_open;
int error;

int main()
{
configurePort();
sendCommand ();
return 0;
}
int configurePort()
{
port_open = 0;

error = OpenComConfig (4, "COM4",115200 ,0,8,1,0, -1);
if (error)
{
printf("Error!\n");
}
if (error == 0)
{
port_open = 1;
SetXMode (4, 0);
SetCTSMode (4, 0);
SetComTime (4, 0);
}


return 0;
}
int sendCommand ()
{
char bufferWrite[100] ;
Fmt(bufferWrite,"%s","ATD0040761768027; ");
ComWrt(4, bufferWrite, 18 );
return 0;
}
Where is the problem? Please help!
Thanks.
 

Hi,
First thing - are baudrate of you UART the same as baudrate of module?
And second one - do you have an oscilloscope to check if sth is getting out of the buffer?
 

Hello,

I solved this problem but now I have another one:)

I am trying to send an sms in text mode using AT commands and I do not understand what I'm doing wrong.

In HyperTerminal the commands are:

AT+CMGF=1 \r

AT+CMGW="0040766560000" \r

The GSM / GPRS modem will then return a prompt "> " and you can start typing the SMS text message.

>Have a nice day.

When finished, press Ctrl+z of the keyboard.

This is my code:


int commandSendSMS()

{
char bW1[100];

Fmt(bW1,"%s","AT+CMGF=1\r");
ComWrt(4, bW1, strlen (bW1));

Fmt(bW1,"%s","AT+CMGW=\"0040766560000\"\r");
ComWrt(4, bW1, strlen (bW1));

Fmt(bW1,"%s","Have a nice day.\032" );

ComWrt(4, bW1, strlen (bW1));

return 0;
}

Can you please help me?
 

And can you tell us what answers do you get from module? When using Hyper Terminal and with your application?
Are there some ERROR massages?
 

Hello,

How can I read every result from the modem after sending AT commands?

Here I send the command AT and the modem result must be OK.

int AT()
{
char bufferWrite[20] ;
char msg[512];
int n = 0;
int nn = 0;

msg[0]='\0';

strcpy(bufferWrite,"AT\r");

ComWrt(number_port, bufferWrite, strlen(bufferWrite));

n = GetOutQLen(number_port);

nn = GetInQLen(number_port);

printf("n is : %d\n",n);

printf("nn is : %d\n",nn);

ComRd(number_port,msg,nn);

printf("The message is : %s\n",msg);

getchar();

return 0;
}


After running the code n = 3 but nn = 0.

Can you help me, pleeease...

This is how I configure my modem :

int configurePort()
{
port_open = 0;

error = OpenComConfig (number_port, "COM4", 115200, 0, 8, 1, 512, 512);



if (error == 0)
{
port_open = 1;
FlushInQ (number_port);
FlushOutQ (number_port);
SetXMode (number_port, 0);
SetCTSMode (number_port, 0);
SetComTime (number_port, 0);
}


return 0;
}

Is There A Problem?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top