Pages: [1]   Go Down
Author Topic: Arduino + GM862 GPS + SoftwareSerial  (Read 1056 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I try to control a GM862-GSM/GPS Modul with AT commands over a SoftwareSerial connection. The transmit of commands works great and every action is running successfully, but the rx data is strange, and i dont know why.

On every call i get some wasted bytes on the front of the data stream and also the size of data is variant. What i don't understand is, that the paket includes the right anwser in the end of the message, but also the wasted data in front of them. I havn't found something about this behavior. Is this problem known by someone or is it perhaps a familiar issue of the SoftwareSerial implementation?

It would be great, it has someone a tip for me to fix the problem or makes it possible to understand the problem himself.

Thanks
Stefan Reusch

Small log of hardware serial port debug output
Code:
Port open
GM862 monitor
AT
10 ->buf: AT
OK

already on
checking network ...
AT+CREG?
30 ->buf: AT+CREG?
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
30 ->buf: ?T+CREG?
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
30 ->buf: ?T+CREG?
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
30 ->buf: E?4J???j?
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
30 ->buf: ??I??
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
30 ->buf: AT+CREG?
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
29 ->buf: Q?*u??
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
30 ->buf: AT+CREG?
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
29 ->buf: ?jiJU??
+CREG: 0,1

OK

done
checking network ...
AT+CREG?
30 ->buf: ?T+CREG?
+CREG: 0,1

OK

done
checking network ...
Logged

Offline Offline
Edison Member
*
Karma: 48
Posts: 1628
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The log is fascinating but essentially useless without your code.

Pete
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

and, we don't know what should be happening, just what is happening so provide code and expected result with actual result. I want to know your baud rate but I can wait, just hand over the code hehe. smiley-evil
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i use a baud rate of 9600 between gsm modul and arduino.

i have reused some of the code from http://tinkerlog.com/2009/05/15/interfacing-arduino-with-a-telit-gm862/ and updated some parts of it to work with arduino 1.0.
the receive loop looks like this at the moment. its was not modified by me, but i think it is not the reason for the currupt data, which is returned.

the function looks like at the moment
Code:
byte GM862::getsTimeout(char *buf, uint16_t timeout) {
byte count = 0;
long timeIsOut = 0;
char c;
bool found = false;
memset(buf, 0, BUF_LENGTH);
timeIsOut = millis() + timeout;
while (timeIsOut > millis() && count < (BUF_LENGTH - 1)) {  
if (modem->available() && !modem->overflow()) {
c = modem->read();
count++;
*buf++ = c;
timeIsOut = millis() + timeout;
}
}
if (count != 0) {
*buf = 0;
count++;
}
return count;
}

then the normal parts to initialize the soft serial port and set baud rate of 9200.

Code:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
modem = modemPort;
modem->begin(9600);

after this some AT commands are transmitted, but it is irrelevant, because the transmit data is ever called by the modul, which is visible on the returned data. one thing, would be possible is, that this are binary debug information, but i cant find something about this in the docs.
« Last Edit: January 12, 2012, 04:48:01 pm by kenterfie » Logged

Offline Offline
Edison Member
*
Karma: 48
Posts: 1628
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the receive loop looks like this at the moment. its was not modified by me, but i think it is not the reason for the bad data
You post a piece of code that you say you haven't modified and which you think is working. Absolutely brilliant.

Pete


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I mean, that this function would work correct, when the softserial class of arduino would return the right data. I have no device to monitor the output/delays at the moment to verify the received data. I think the problem is related to the softserial class or to the gsm modul. What i try at the moment is to vary the delay timings, but this has nothing changed until now. Sorry, when i do something wrong, but it is my first arduino project and if something missing or not meaningful enough, then i try to post more info about the problem.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, i have found now, that 38400 are suggested, after a short try the returned data looks good, but i cant believe this was the reason for it.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Where did you find the recommended speed being 38400? I was never able to use that fast speed.
Logged


Offline Offline
Edison Member
*
Karma: 48
Posts: 1628
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The link at tinkerlog.com that OP posted uses 19k2 so I'd be interested to know where/who recommends 38k4.
I also can't believe that using 38k4 fixed the problem.

Pete
Logged

Pages: [1]   Go Up
Jump to: