techstudio-design / SimpleNB

A simple Arduino library for communication with NB-IoT/Cat-M1 modules
GNU Lesser General Public License v3.0
32 stars 4 forks source link

SIMCOM SIM7070G - GSM Location failed #3

Closed A-n-d-y-K closed 2 years ago

A-n-d-y-K commented 2 years ago

[x] I have read the Troubleshooting section of the ReadMe

What type of issues is this?

[ ] Request to support a new module

[ ] Bug or problem compiling the library [ ] Bug or issue with library functionality (ie, sending data over TCP/IP) [x] Question or request for help

What are you working with?

Modem: SIMCOM SIM7070G PCIe Revision:1951B04SIM7070 Main processor board: LilyGO T-PCIE ESP32 SimpleNB version: Code:

Scenario, steps to reproduce

usage of getGsmLocationImpl(CellLBS_t& lbs, int cid) with all 4xcids of SIM7070G

Expected result

AT+CLBS=4,0  //Get current longitude , latitude , Precision and date time
+CLBS:

0,121.359544,31.220071,550,2019/05/09,08:01:07

Actual result

see AT Log Below

Issue Description

Deat SimpleNB community 1st of all thanks much for providing this public repo. I´m struggeling with getting Location via Mobile Cells. SIMCOM provides there AT Command AT+CLBS which should give back coodinates similar to GPS. Sadly it is not working on my side. I don´t understand the error codes from SIM7070G.

Questions

Debug and AT command log

Snippet of AT Log

...
AT+CNACT?
+CNACT: 0,1,"100.97.10.53"
+CNACT: 1,0,"0.0.0.0"
+CNACT: 2,0,"0.0.0.0"
+CNACT: 3,0,"0.0.0.0"
....
[19515] modem.getGsmLocation try no.  0
AT+CLBS=4,0
+CLBS: 1 // Location Failed
OK
[26632] modem.getGsmLocation try no.  1
AT+CLBS=4,1
+CLBS: 3 // NET Error
OK
[27729] modem.getGsmLocation try no.  2
AT+CLBS=4,2
+CLBS: 3 // NET Error
OK
[28826] modem.getGsmLocation try no.  3
AT+CLBS=4,3
+CLBS: 3 // NET Error

Complete AT Log

...
AT

OK
ATE0

OK
AT+CMEE=2

OK
AT+GMM

OK
[3498] ### Modem: 
AT+CLTS=1

SIMCOM_SIM7070

OK
AT+CBATCHK=1

OK
AT+CPIN?

OK

+CPIN: READY

OK
AT+GMM

SIMCOM_SIM7070

OK
[4389] ### Modem: SIMCOM SIM7070
AT+CLTS=1

OK
AT+CBATCHK=1

OK
AT+CPIN?

+CPIN: READY

OK
[4604] SIM7070G_Connect()
AT+CNMP=38

OK
AT+CMNB=2

OK
AT+CBANDCFG="NB-IOT",20
AT+CPIN?

OK

+CPIN: READY

OK
[5055] getSimStatus 1
[5055] Waiting for network...
waitForNetworkImpl()     5055
AT+CEREG?

+CEREG: 0,2

OK
AT+CGREG?

+CGREG: 0,2

OK
TinyGSMDebug: waitForNetworkImpl()     5510
AT+CEREG?

+CEREG: 0,2

OK
AT+CGREG?

+CGREG: 0,2
....
// deleted AT+CGREG? polling
....
AT+CEREG?

+CEREG: 0,2

OK
AT+CGREG?

+CGREG: 0,5

OK
AT+CEREG?

+CEREG: 0,5

OK
[13080] Network connected
[13080] Connecting to lpwa.vodafone.com
AT+CNACT=0,0

+CME ERROR: operation failed
AT+CGDCONT=1,"IP","lpwa.vodafone.com"

DST: 1
[13207] ### Daylight savings time state updated.

*PSUTTZ: 22/06/12,08:49:42","+08",1
[13259] ### Network time and time zone updated.

+CTZV: 8
[13300] ### Network time zone updated.

OK
AT+CGATT=1

OK
AT+CGNAPN

+CGNAPN: 1,"lpwa.vodafone.com"

OK
AT+CNCFG=0,1,"lpwa.vodafone.com"

OK
AT+CNACT=0,1

OK

+APP PDP: 0,ACTIVE
AT+CGATT?

+CGATT: 1

OK
AT+CNACT?

+CNACT: 0,1,"100.97.10.53"
+CNACT: 1,0,"0.0.0.0"
+CNACT: 2,0,"0.0.0.0"
+CNACT: 3,0,"0.0.0.0"

OK
[15316] GPRS connected
AT+COPS?

+COPS: 0,0,"Vodafone.de DATA ONLY",9

OK
AT+COPS?

+COPS: 0,0,"Vodafone.de DATA ONLY",9

OK
AT+COPS?

+COPS: 0,0,"Vodafone.de DATA ONLY",9

OK
AT+COPS?

+COPS: 0,0,"Vodafone.de DATA ONLY",9

OK
[16144] IPAddr Init: 255.255.255.255
AT+CNACT?

+CNACT: 0,1,"100.97.10.53"
+CNACT: 1,0,"0.0.0.0"
+CNACT: 2,0,"0.0.0.0"
+CNACT: 3,0,"0.0.0.0"

OK
[16597] IPAddr: 100
AT+CSQ

+CSQ: 10,99

OK
AT+CNSMOD?

+CNSMOD: 0,9

OK
[16995] getNetworkSystemMode() tempAutoReport: 0 tempNWMode: 9
AT+CCLK?

+CCLK: "22/06/12,10:49:45+08"

OK
AT+CCLK?

+CCLK: "22/06/12,10:49:46+08"

OK
AT+CCLK?

+CCLK: "22/06/12,10:49:46+08"

OK
AT+CCLK?

+CCLK: "22/06/12,10:49:46+08"

OK
AT+CBC

+CBC: 0,78,4019

OK
AT+GMR

Revision:1951B04SIM7070

OK
AT+GMR

Revision:1951B04SIM7070

OK
AT+GMR

Revision:1951B04SIM7070

OK
AT+GMR

Revision:1951B04SIM7070

OK
AT+GMM

SIMCOM_SIM7070

OK
[19250] Modem Name: SIMCOM SIM7070
ATI

R1951.01

OK
[19351] Modem Info: R1951.01
[19351] Modem Firmware Version: Revision:1951B04SIM7070
AT+CCID

89882390000112180438

OK
[19409] CCID: 89882390000112180438
AT+GSN

861340049967795

OK
[19451] IMEI: 861340049967795
AT+CIMI

901288003707822

OK
[19493] IMSI: 901288003707822
[19493] Network Operator: Vodafone.de DATA ONLY
[19493] Signal quality: 10
[19494] Network System Mode: 9
[19504] Local IP: 100.97.10.53
[19504] Current Network Time: 22/06/12,10:49:46
[19504] Modem Voltage: 4019 mV
[19505] Connection Establishment Time: 10261 ms
[19515] Firebase begin()

[19515] modem.getGsmLocation try no.  0
AT+CLBS=4,0

+CLBS: 1

OK
[26632] modem.getGsmLocation try no.  1
AT+CLBS=4,1

+CLBS: 3

OK
[27729] modem.getGsmLocation try no.  2
AT+CLBS=4,2

+CLBS: 3

OK
[28826] modem.getGsmLocation try no.  3
AT+CLBS=4,3

+CLBS: 3

OK
[29923] modem.getGsmLocation try no.  0
AT+CLBS=4,0

+CLBS: 1

OK
[36490] modem.getGsmLocation try no.  1
AT+CLBS=4,1

+CLBS: 3

OK
[37587] modem.getGsmLocation try no.  2
AT+CLBS=4,2

+CLBS: 3

OK
[38684] modem.getGsmLocation try no.  3
AT+CLBS=4,3

+CLBS: 3

OK
[39781] modem.getGsmLocation try no.  0
AT+CLBS=4,0

+CLBS: 1

OK
[46888] modem.getGsmLocation try no.  1
AT+CLBS=4,1

+CLBS: 3

OK
[47985] modem.getGsmLocation try no.  2
AT+CLBS=4,2

+CLBS: 3

OK
[49082] modem.getGsmLocation try no.  3
AT+CLBS=4,3

+CLBS: 3

OK
[50179] modem.getGsmLocation try no.  0
AT+CLBS=4,0

+CLBS: 1

OK
[57151] modem.getGsmLocation try no.  1
AT+CLBS=4,1

+CLBS: 3

OK
[58248] modem.getGsmLocation try no.  2
AT+CLBS=4,2

+CLBS: 3

OK
[59345] modem.getGsmLocation try no.  3
AT+CLBS=4,3

+CLBS: 3

OK
[60442] modem.getGsmLocation try no.  0
AT+CLBS=4,0

+CLBS: 1

OK
[67359] modem.getGsmLocation try no.  1
AT+CLBS=4,1

+CLBS: 3

OK
[68456] modem.getGsmLocation try no.  2
AT+CLBS=4,2

+CLBS: 3

OK
[69553] modem.getGsmLocation try no.  3
AT+CLBS=4,3

+CLBS: 3

OK
[70650] modem.getGsmLocation try no.  0
AT+CLBS=4,0

+CLBS: 1

OK
[82012] modem.getGsmLocation try no.  1
AT+CLBS=4,1

+CLBS: 3

OK
[83109] modem.getGsmLocation try no.  2
AT+CLBS=4,2

+CLBS: 3

OK
techstudio-design commented 2 years ago

As SIMCOM has no longer supports SIM7070 so I no longer keep SIM7070 module with me anymore. However, getGsmLocation() method is the same across all SIMCOM modules. So I run a test on a SIM7080, and here is the screen log of running GSM_Location.ino example.

[41] Powering Up...
[3542] Communicate at baud rate 115200 ...
[9601] Initializing modem...
[9601] ### SimpleNB Version: 1.0.0
[9601] ### SimpleNB Compiled Module:  SimpleNBClientSIM7080
AT
AT
OK
ATE0
ATE0
OK
AT+CMEE=2

OK

AT+GMM

SIMCOM_SIM7080

OK
AT+CLTS=1

OK
AT+CBATCHK=1

OK
AT+CPIN?

+CPIN: READY

OK
[9647] Waiting for network registration...
AT+CSQ

+CSQ: 20,99

OK
AT+CEREG?

+CEREG: 0,1

OK
[9665] Activate Data Network...

AT+CNACT=0,1

OK

+APP PDP: 0,ACTIVE
[10693] Requesting current GSM location with GMT time
AT+CLBS=4,0

+CLBS: 0,103.8xxxxxx,1.3xxxxxx,550,2022/06/26,12:08:39

OK
[11367] Latitude: 103.8xxxxxxx  Longitude: 1.3xxxxxxx
[11368] Accuracy: 550.00
[11368] Year: 2022      Month: 6        Day: 26
[11369] Hour: 12        Minute: 8       Second: 39
[11380] Powering Off...
AT+CPOWD=1

NORMAL POWER DOWN[11392] Done!

Noticed that all the commands used above are the same for SIM7070.

Here is what I will suggest to do, if you could connect your module/board to a UART, do so and manually turn on the module, use a tool such as AT Command Tester if you use Windows, or CoolTerm if you are using macOS, and directly input the following AT commands to see whether it will work:

AT                            //to sync the baud rate, it will return OK if baud rate is right
AT+CSQ                  //make sure the return value xx in +CSQ: xx,99 is not 99
AT+CEREG?            //make sure it return +CEREG:x,1
AT+CNACT=0,1      //this should return +APP PDP: 0,ACTIVE
AT+CLBS=4,0        //make sure that the 0 in +APP PDP:0,ACTIVE, and this should return +CLBS: 0,103.8xxxxxx,1.3xxxxxx,550,2022/06/26,12:08:39

That's all the commands needed for getting the GSM location. Please noted that it take roughly 3s for the SIMCOM modules to response to AT command from power up, and roughly 6-7s to register to the network.

If It this failed, then you probably need to check with your carrier. GMS location is a 2.5G technology and many 4G carriers may not provision its network to provide the service. We also seen some crazy carriers wanting to charge this service for extra VAS fee despite it has an accuracy of +/-500m.

techstudio-design commented 2 years ago

As SIMCOM has no longer supports SIM7070...

Sorry, my bad, I mistaken it as SIM7000 which has end of the support, not SIM7070.

SIM7070 is same as SIM7080 based on the same Qualcomm chipset. The only difference is footprint and power class. So what works on SIM7080 should works on SIM7070...

A-n-d-y-K commented 2 years ago

Hello @techstudio-design, thanks much for your fast answer and your suggestions. You stated that:

AT+CEREG? //make sure it return +CEREG:x,1

On my side SIM7070G returns always "+CEREG: 0,5" on different locations. As per "AT+CLBS Base station Location" documentation

Questions

  1. Does AT+CLBS require to be registered into home network to give back a valid location?
  2. Is there a way to reset factory settings to SIM7070G similar to other SIMCOM Moduls via AT&F?

Thanks in advance

techstudio-design commented 2 years ago

On my side SIM7070G returns always "+CEREG: 0,5" on different locations.

That's not normal, I noticed you are on Vodafone.de network, aren't you using a Vodafone.de sim card? Is the sim card an NB-IoT/CAT M1 sim? Roaming simply not work for NB-IoT/CAT M1 as there is no roaming agreement across carriers available now in the world.

Does AT+CLBS require to be registered into home network to give back a valid location?

I'm not very sure. What the AT+CLBS does internally is to gather the base stations information and send to the backend which will dip a database to come out the approximate location.

Is there a way to reset factory settings to SIM7070G similar to other SIMCOM Moduls via AT&F?

Yes, there is a factorDefault() method that does that (also setup a few other default values), there is also a sketch in tools/FactoryReset.ino.

Instead of doing that, I would suggest you do a soft reset by pressing the PWRKEY for more than 10s, the module will reset and restart itself. This sometime will do the trick.

A-n-d-y-K commented 2 years ago

HI @techstudio-design,

SIM Card

[AndyK]On my side SIM7070G returns always "+CEREG: 0,5" on different locations. [Techstudio]That's not normal, I noticed you are on Vodafone.de network, aren't you using a Vodafone.de sim card? Is the sim card an NB-IoT/CAT M1 sim? Roaming simply not work for NB-IoT/CAT M1 as there is no roaming agreement across carriers available now in the world.

[AndyK] I´m using a Vodafone Easy Connect SIM Card in NB-IoT network. Honestly SIM 7070G all the time returns "+CEREG: 0,5". To get more insights about the mobile cell I´m registered to I used Engineering Mode Command. As far as I understood Cell 0 is the one I´m registered to Cell 1 & 2 are the neighbor cells.

AT+CENG?

+CENG: 1,1,3,LTE NB-IOT +CENG: 0,"6346,363,-104,-93,-11,3,47922,52334695,262,02,255" +CENG: 1,"6346,343,-113,-94,-19,3" +CENG: 2,"6346,210,-108,-92,-16,3" Based Command description the registered Cell Info is:

  • MCC: 262
  • MNC: 2
  • LAC: liefert unser SIM7070G Modul nicht
  • TAC: 47922
  • Cell ID: 52334695 I tried several cell searching websites sadly Cell 0 I never found

Questions

Factory Reset I tried 2 options Opt 1) PWRKEY > 12.5sec & Opt 2) factoryDefaultImpl() I assume this function does nothing. So I tried the one from TinyGSM Outcome: I do have my doubts that SIM7070G did a factory reset. Why? Before reset I used AT+CBANDCFG to limit network search to band 20 only. After Reset (both methods), a AT+CBANDCFG? returns with band 20 only.

Question Are there setting ins SIM7070G which could not set back to factory defaults or is factory reset not working on my side.

Thanks in advance for your expertise

techstudio-design commented 2 years ago

AT+CENG?

+CENG: 1,1,3,LTE NB-IOT +CENG: 0,"6346,363,-104,-93,-11,3,47922,52334695,262,02,255" +CENG: 1,"6346,343,-113,-94,-19,3" +CENG: 2,"6346,210,-108,-92,-16,3"

I used your AT+CENG? info trying to get a the location, I get "location not found" error. I think you should check with your carrier.

Where to find a mapping tool which supports NB-IoT Cells?

I don't understand what you means "mapping tool"?

With my Vodafone SIM, APN = lpwa.vodafone.com is it roaming?

I don't know. I think you need to check with your carrier if you are not sure. BTW, if you are registering to the network using AT+CEREG (i.e. 4G networks), the APN is totally irrelevant. Unless you are registering to the network using AT+CGREG, then APN will be required. One of the major changes between SimpleNB versus TinyGSM is that we use AT+CEREG for network registration.

Is AT+CLBS not giving me a Location because of "+CEREG: 0,5"?

I think that I answer this on my previous reply that I'm not very sure. Again, you need to check with your carrier whether GSM LBS is supported on the network or not.

Before reset I used AT+CBANDCFG to limit network search to band 20 only. After Reset (both methods), a AT+CBANDCFG? returns with band 20 only.

I think it is very likely that among all the Vodafone network, Band 20 is the only network that offers NB-IOT service, this is often the case in many carrier's case, they haven't see the return on investment or business case to support the deployment of NB-IoT across all its bands yet.

I think by now, most of the questions you have are beyond the SimpleNB. I think you really need to check with your carrier or your vendor/distributor for SIMCOM modules and get supports from them.

A-n-d-y-K commented 2 years ago

Hello @techstudio-design , thanks for your answers. Meanwhile I got feedback from Vodafone

+CEREG: 0,5" // Registered, roaming [Vodafone] SIM Card "Vodafone Easy Connect" is a global SIM. -> Always Roaming

+CLBS: 1 // Location Failed [Vodafone] AT+CLBS not working in case of Roaming

👎 Honestly in very disapointed. 👎

Mapping Tool Tools for looking up location of mobile cells. E.g.

Questions

Thanks in advance

techstudio-design commented 2 years ago

Do you see a possibility to get a Location without using GNSS? +-500m accuracy would be fine for me

Yes, in fact all map providers such as google, here.com, etc., all provide location dipping api. Take a look at the position api at developer.here.com. There is a free tier service, you just need to sign up to get the access key. You can use AT+CENG? query result to generate a json object and send it to the service to get a lat, long and accuracy data back. However, as I mentioned on my previous reply, I did use the data from your AT+CENG? result to query the location via here.com api, and I get a "location not found". This could because the same reason that it can't provide the location while roaming. But you could give it a try.

(MCC: 262, MNC: 2, LAC: NaN, TAC: 47922, Cell ID: 52334695)

AT+CENG? command provides all the information you need to get the location. BTW, LAC is only relevant for GSM networks, for 4G/NB-IoT, please read the here.com api document on the information needs and cross reference to the SIMCOM AT Command Manual for AT Command Manual on AT+CENG? command (page 141) for NB-IoT return result.

A-n-d-y-K commented 2 years ago

Hello @techstudio-design , meanwhile I do have an here account with an App created and a the Service Positioning API to it. For testing purpose I want to use curl to place the needed POST request. Sadly I´m not able to manage it. May you could help me out with the request you are using. That I could adapt it with my API-Key

Thanks in advance

techstudio-design commented 2 years ago

Did you try the example provided by the API?

{
  "lte": [
    {
      "mcc": 262,
      "mnc": 2,
      "cid": 2898945,
      "rsrp": -50, "rsrq": -5,
      "nmr": [
        { "earfcn": 6300, "pci": 237, "rsrp": -60, "rsrq": -6 },
        { "earfcn": 6300, "pci": 442, "rsrp": -70, "rsrq": -7 }
      ]
    }
  ]
}

Noticed that the example HERE provided happened to be on the same mcc and mnc as yours. The "rsrp" and "rsrq" values are optional, if you omit those values, the request will still work.

As I mentioned previously, a request based on your AT+CENG? data return "position not found". I suspect the cid is unknown for some reason.

{
  "lte": [
    {
      "mcc": 262,
      "mnc": 2,
      "cid": 52334695,
      "rsrp": -104, "rsrq": -11,
      "nmr": [
        { "earfcn": 6346, "pci": 343, "rsrp": -113, "rsrq": -19 },
        { "earfcn": 6346, "pci": 210, "rsrp": -108, "rsrq": -16 }
      ]
    }
  ]
}

Use Postman instead of curl if you have difficulty to create the CLI command.

@A-n-d-y-K, I am going to close this issue as your questions and requests are no longer SimpleNB related, it is clean now that the problem you are facing is network specific, and I've tried to help as much as I could to this stage.

A-n-d-y-K commented 2 years ago

Dear @techstudio-design, thanks for the hint using tool "POSTMAN". I got also a negative response to the POST request.

Nevertheless thanks very much for your support and providing this repository.

{
    "title": "Not Found",
    "status": 404,
    "code": "E606404",
    "action": "The values provided in the request cannot produce any content for the response. The location of the WLANs and cells in the request is unknown or the locations of the radio measurements are so widely scattered that the location cannot be determined. Make sure that the network measurements are correct and consistent. Try allowing fallbacks `area` or `any` for cell positioning and `singleWifi` for WLAN positioning.",
    "cause": "Position not found",
    "correlationId": "64b3d10b-0e04-4f16-978a-919f1dd5ba05"
}