I’m working on an application that uses a sim7000 breakout board and STM32L053R8 (with the I-Nucleo-LRWAN1 expansion board).
Now I have to read data from the gps with sim7000 in the serial of STM32L0.
When the chip is connecting to the satellite I read this in the serial:
AT+CGNSINF
+CGNSINF: 0,,,,,,,,,,,,,,,,,,,,
OK
comand send
AT+CGNSINF
+CGNSINF: 1,0,,,,,,,0,,,,,,1,,,,49,,
OK
comand send
ant it’s ok.. but when it connects to satellite I read on the serial this:
comand send
AT+CGNSINF
+CGNSINF: 1,1,20180821145743.000,38.121140,15.666
comand send
AT+CGNSINF
+CGNSINF: 1,1,20180821145745.000,38.121241,15.665
comand send
AT+CGNSINF
+CGNSINF: 1,1,20180821145747.000,38.121229,15.665
I don’t understand why the data after +CGNSINF are not complete, in fact it should be something like:
AT+CGNSINF
+CGNSINF: 1,1,20180821151003.000,38.121095,15.666267,80.200,0.00,0.0,1,,0.7,1.0,0.7,,18,10,,,46,,
The code that I’m using is this:
HardwareSerial SerialForSim7000(PA_10, PA_9);
HardwareSerial SerialLora(PC_11, PC_10);
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
SerialForSim7000.begin(9600);
SerialForSim7000.write("AT+CGNSCFG=1 \r\n");
delay(500);
SerialForSim7000.write("AT+CGNSPWR=1 \r\n");
delay(500);
}
void loop() // run over and over
{
SerialForSim7000.write("AT+CGNSINF \r\n");
while(SerialForSim7000.available())
Serial.write(SerialForSim7000.read());
Serial.println();
Serial.write("comand send");
Serial.println();
delay(2000);
}
[edogaldo – Tue Aug 21, 2018 3:39 pm] –
try checking the SerialForSim7000 read buffer size.
how can i check this?
Can I fix it with a lower baud rate?
Ty
Ty 4 help

You can try to raise the buffer here:
https://github.com/stm32duino/I-NUCLEO- … hw_usart.h
Line 53: #define SERIAL_RX_BUFFER_SIZE 256
I would try 512 or something.
If it works, please open an issue on github.
[madias – Tue Aug 28, 2018 11:35 am] –
I do not own the board or LRWAN, but after some googleing:
You can try to raise the buffer here:
https://github.com/stm32duino/I-NUCLEO- … hw_usart.h
Line 53: #define SERIAL_RX_BUFFER_SIZE 256
I would try 512 or something.
If it works, please open an issue on github.
Ty for help madias!
I try this but it doesn’t work. This is the code
#include "LoRaRadio.h"
#include "lora_driver.h"
HardwareSerial SerialForSim7000(PA_10, PA_9);
HardwareSerial SerialLora(PC_11, PC_10);
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
SerialForSim7000.begin(9600);
SerialForSim7000.write("AT+CGNSCFG=1 \r\n");
delay(500);
SerialForSim7000.write("AT+CGNSPWR=1 \r\n");
delay(500);
}
void loop() // run over and over
{
SerialForSim7000.write("AT+CGNSINF \r\n");
while(SerialForSim7000.available())
Serial.write(SerialForSim7000.read());
Serial.println();
Serial.write("comand send");
Serial.println();
delay(2000);
}
Serial.write(SerialForSim7000.read());
char risp[94];
String latval;
double lat;
String longval;
HardwareSerial SerialForSim7000(PA_10, PA_9);
HardwareSerial SerialLora(PC_11, PC_10);
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
SerialForSim7000.begin(9600);
SerialForSim7000.write("AT+CGNSCFG=1 \r\n");
delay(500);
SerialForSim7000.write("AT+CGNSPWR=1 \r\n");
delay(500);
}
void loop() // run over and over
{
SerialForSim7000.write("AT+CGNSINF \r\n");
delay(30);
while(SerialForSim7000.available()){
for(int n=0; n<94; n++)
{
risp[n] = SerialForSim7000.read(); //here I put the char into array
}
}
Serial.println();
Serial.write("comand send");
Serial.println();
for(int n=36;n<55;n++){
Serial.print(risp[n]); //I print the arry
}
Serial.println();
for(int n=36; n<45;n++)
latval += risp[n]; //I put the firs part ofarray into a String
Serial.println(latval);
float lat=latval.toFloat(); //convert a string into floa
Serial.println(lat);
latval=""; //clen string
delay(2000);
}
https://github.com/stm32duino/Arduino_C … 2/pull/313
I’ve tested with this sketch based on yours:
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
for (uint32_t n = 0; n < sizeof(risp); n++) {
Serial.print(risp[n]); //I print the array
}
Serial.println();
for (uint32_t n = 0; n < 9; n++)
latval += risp[n]; //I put the firs part ofarray into a String
Serial.println(latval);
float flat = latval.toFloat(); //convert a string into float
Serial.println(flat);
lat = latval.toDouble(); //convert a string into double
Serial.println(lat, 6);
}
void loop() // run over and over
{
}
‘class String’ has no member named ‘toDouble’
this is the code in file WString.cpp: (line 741-750)
float String::toFloat(void) const
{
return float(toDouble());
}
double String::toDouble(void) const
{
if (buffer) return atof(buffer);
return 0;
}
[borombo96 – Tue Sep 04, 2018 2:08 pm] –
This is the root of the file WString.h and WString.cpp C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino
This is not the right core, this is the avr core not the STM32.
You can find the source using this:
https://github.com/stm32duino/wiki/wiki … re-sources
All Comments