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.

Problem with response from GSM modem

Status
Not open for further replies.

rckt

Newbie level 2
Joined
Dec 2, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
Hello,
I'm writing a code in C++ to send AT commands to a GSM modem. According to the modem manual, these are the settings that should be entered in hyperterminal:
Bits per second: 115200
Data bits: 8
Parity: None
Stop bits: 1
Flow control: Hardware

In my code, these are the dcb settings for the COM port that I put:
m_comport.dcb.BaudRate = 115200;
m_comport.dcb.ByteSize = 8;
m_comport.dcb.Parity = NOPARITY;
m_comport.dcb.StopBits = ONESTOPBIT;
m_comport.dcb.fDtrControl = DTR_CONTROL_ENABLE;
m_comport.dcb.fOutxCtsFlow = TRUE;
m_comport.dcb.fTXContinueOnXoff = TRUE;
m_comport.dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
m_comport.dcb.fAbortOnError = TRUE;
m_comport.dcb.XonLim = 80;
m_comport.dcb.XoffLim = 200;

My problem is that when I start the modem for the first time of the day, or after a long period of time of not using it, when I run my code, there is no response from the modem (buffer empty). But when I run using hyperterminal, it comes out fine (I get "OK" as the response for my AT command). Then, when I run my code after that only will I get response from the modem, as expected. I've been experiencing this problem for some days.
Another problem is that sometimes there are some weird characters, instead of the correct characters, are mixed in the response. But they are not random characters. Every time the weird characters come in the response, they are the same ones. For example, if I send ATE0, in the response, instead of the letter 'O' for OK, there is another character in its place, but the 'K' comes out correct. This problem is hard to be reproduced because I'm not sure why it happens, but it happens quite often, usually when there is a problem with the previous sending of command, I think.

Any help would be much appreciated.
Thanks
 

according to your first problem i cant say any thing but about your second problem try to low the baud rate.
if u r using auto baud option then config it manually to a lower one.

regards
 

according to your first problem i cant say any thing but about your second problem try to low the baud rate.
if u r using auto baud option then config it manually to a lower one.

regards

I tried using a lower baud rate, but it didn't work. The garbled characters actually have an extra 1 on the 8th bit. For example, '\r' which has a value of 13 (1101 in binary) becomes the square shape character with the value 141 (10001101), while 'O' which has a value of 79 (1001111) becomes Ï which has a value of 207 (11001111). Other characters ('K' and '\n') came out correctly.
How can I correct this?

thanks.
 

It may be an autobaud problem. To make the autobaud work correctly, you need to send individual characters 'A' and 'T' with surrounding delay, as if typed manually at Hyperterminal. Fixed serial parameters in the non-volatile modem settings are another option.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top