Hi everyone,
I'm currently developping a C program to drive a Telit GM862-GPS module using the serial port of an embedded board (SBC9261).
The communication with the module is based on
AT commands : I just send my command to the module, through the RS232 line, and the module answers immediately.
Here's an example with a basic command returning the GPS's acquired position, sent with Minicom :
Code:
AT$GPSACP
$GPSACP: 104323.000,4x45.6171N,00x38.6219E,0.8,446.5,3,272.14,0.21,0.11,080311,09
OK
Then, I've been able to make my C program send those kind of
AT commands, from the SBC9261 board to the Telit module. It works fine, the module answers, but something still bothers me : when I read the answer of the module, it always starts with the command I just sent.
Example :
Code:
<Declaration and initialization of the file descriptor "fd" here...>
write(fd, "AT$GPSACP\r", strlen("AT$GPSACP\r"));
read(fd, &read, 50);
printf("Reading on ttyS1 : %s\n", read);
/*Output :
AT$GPSACP
$GPSACP: 104323.000,4x45.6171N,00x38.6219E,0.8,446.5,3,272.14,0.21,0.11,080311,09
OK/*
/*Should be :
$GPSACP: 104323.000,4x45.6171N,00x38.6219E,0.8,446.5,3,272.14,0.21,0.11,080311,09
OK
*/
I guess I'm missing something in the initial configuration of the file descriptor (when setting the
termios struct). I googled around and tried different settings with ICANON, but I'm still stuck. Do you guys have seen this before ?
Or do you think this could be a normal behaviour of the transmission ?
Any suggestions appreciated !
Thank you for your answers !