Closed adityathakekar closed 3 years ago
@adityathakekar This issue has an incomplete or old issue template.For future reference please use an up to date clone of the repository before raising issues. Many thanks.
Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-3552
@adityathakekar This issue has an incomplete or old issue template.For future reference please use an up to date clone of the repository before raising issues. Many thanks.
Hey, i am using up to date clone of repository and the code does not work ,connecting to bg96 cellular nb iot using udp. Changed the uart pins to D1 and D0.
Apologies for the bots, they can't be reasoned with.
I don't have your board unfortunately so you'll have to help me out a bit. Can you please enable traces, set them to debug level and share the log?
You can also try turning on AT prints with cellular.debug-at.
Modem power on Connecting to cellular context in 0ms
and the timer continues. There is no connection with cellular network. cellular.debug.at = true
I'd expect a bit more prints if you had tracing on.
23:18:09.448 ->
[2K[33m[00011627ms][WARN][CELL]: URC already added with prefix: +CGEV: NW DEACT[0m
23:18:09.448 ->
[2K[33m[00011627ms][WARN][CELL]: URC already added with prefix: +CGEV: ME DEACT[0m
23:18:09.448 ->
[2K[33m[00011628ms][WARN][CELL]: URC already added with prefix: +CGEV: NW PDN D[0m
23:18:09.448 ->
[2K[33m[00011628ms][WARN][CELL]: URC already added with prefix: +CGEV: ME PDN D[0m
23:18:09.495 ->
[2K[33m[00011636ms][WARN][CELL]: URC already added with prefix: +QIURC: "pdpde[0m
23:18:09.495 ->
[2K[39m[00011644ms][INFO][CELL]: AT TX ( 4): ATE0[0m
23:18:09.495 ->
[2K[39m[00011649ms][INFO][CELL]: AT TX ( 1):
Doesn't look like your modem ever powers on.
Are you sure you're using the latest cellular example? Please clone this repo, git checkout development
, mbed deploy
. Change the mbed_app.json options for tracing to true, set trace level to debug, enable at traces. Compile and flash. Connect serial and dump it into a file, attach the file with the log to the issue together with your json.
Here's a normal log:
mbed-os-example-cellular
[00001000ms][INFO][CELL]: New CellularContext (0x20007B58)
Establishing connection
[00001000ms][INFO][CELL]: CellularContext connect
[00001000ms][DBG ][CELL]: callback: 4106, err: 0, data: 4096
[00001000ms][INFO][CELL]: Start connecting (timeout 1000 ms)
[00001062ms][INFO][CELL]: AT TX ( 2): AT
[00001121ms][INFO][CELL]: AT TX ( 1): <cr>
[00002063ms][DBG ][CELL]: AT error -3012
[00002063ms][INFO][CELL]: AT TX ( 2): AT
[00002063ms][INFO][CELL]: AT TX ( 1): <cr>
[00003064ms][DBG ][CELL]: AT error -3012
[00003064ms][DBG ][CELL]: Init => Power
[00003064ms][DBG ][CELL]: callback: 4106, err: 0, data: 4096
[00003064ms][INFO][CELL]: Modem power ON (timeout 1000 ms)
[00004068ms][DBG ][CELL]: Power => Device ready
[00004068ms][DBG ][CELL]: callback: 4106, err: 0, data: 4096
[00004068ms][DBG ][CELL]: Device was not ready, calling soft_power_on()
[00005368ms][DBG ][CELL]: AT flush
[00005368ms][INFO][CELL]: AT TX ( 4): ATE0
[00005368ms][INFO][CELL]: AT TX ( 1): <cr>
[00006369ms][DBG ][CELL]: AT error -3012
[00006369ms][DBG ][CELL]: Wait 100ms to init modem
[00006469ms][DBG ][CELL]: AT flush
[00006469ms][INFO][CELL]: AT TX ( 4): ATE0
[00006469ms][INFO][CELL]: AT TX ( 1): <cr>
[00007470ms][DBG ][CELL]: AT error -3012
[00007470ms][DBG ][CELL]: Wait 100ms to init modem
[00007570ms][DBG ][CELL]: AT flush
[00007570ms][INFO][CELL]: AT TX ( 4): ATE0
[00007570ms][INFO][CELL]: AT TX ( 1): <cr>
[00008571ms][DBG ][CELL]: AT error -3012
[00008571ms][DBG ][CELL]: Wait 100ms to init modem
[00008671ms][DBG ][CELL]: Device ready: retry 0/10
[00008671ms][DBG ][CELL]: callback: CellularStateRetryEvent, err: 0, data: 4096, retrycount: 0
[00008671ms][INFO][CELL]: Continue after 1 seconds
[00009682ms][DBG ][CELL]: callback: 4106, err: 0, data: 4096
[00009682ms][DBG ][CELL]: Device was not ready, calling soft_power_on()
[00010982ms][WARN][CELL]: URC already added with prefix: +CGEV: NW DEACT
[00010982ms][WARN][CELL]: URC already added with prefix: +CGEV: ME DEACT
[00010982ms][WARN][CELL]: URC already added with prefix: +CGEV: NW PDN D
[00010989ms][WARN][CELL]: URC already added with prefix: +CGEV: ME PDN D
[00011081ms][DBG ][CELL]: AT flush
[00011133ms][INFO][CELL]: AT TX ( 4): ATE0
[00011193ms][INFO][CELL]: AT TX ( 1): <cr>
[00011254ms][INFO][CELL]: AT RX (11): atE0<cr><cr><ln>OK<cr><ln>
[00011337ms][INFO][CELL]: AT TX ( 9): AT+CMEE=1
[00011403ms][INFO][CELL]: AT TX ( 1): <cr>
[00011463ms][INFO][CELL]: AT RX ( 6): <cr><ln>OK<cr><ln>
[00011538ms][INFO][CELL]: AT TX ( 9): AT+CFUN=1
[00011604ms][INFO][CELL]: AT TX ( 1): <cr>
[00011664ms][INFO][CELL]: AT RX ( 6): <cr><ln>OK<cr><ln>
[00011739ms][INFO][CELL]: AT TX ( 7): AT+CGMI
[00011803ms][INFO][CELL]: AT TX ( 1): <cr>
[00011863ms][INFO][CELL]: AT RX (32): <cr><ln>+QIND: PB DONE<cr><ln><cr><ln>Quectel<cr><ln><cr><ln>O
[00011984ms][INFO][CELL]: AT RX ( 3): K<cr><ln>
[00012049ms][INFO][CELL]: Modem manufacturer: +QIND: PB DONE
Quectel
[00012144ms][INFO][CELL]: AT TX ( 7): AT+CGMM
[00012208ms][INFO][CELL]: AT TX ( 1): <cr>
[00012268ms][INFO][CELL]: AT RX (14): <cr><ln>UG96<cr><ln><cr><ln>OK<cr><ln>
[00012364ms][INFO][CELL]: Modem model: UG96
[00012430ms][INFO][CELL]: AT TX ( 7): AT+CGMR
[00012493ms][INFO][CELL]: AT TX ( 1): <cr>
[00012554ms][INFO][CELL]: AT RX (26): <cr><ln>UG96LNAR02A06E1G<cr><ln><cr><ln>OK<cr><ln>
[00012662ms][INFO][CELL]: Modem revision: UG96LNAR02A06E1G
[00012743ms][INFO][CELL]: Modem ready
[00012798ms][DBG ][CELL]: callback: 4096, err: 0, data: 4096
[00012878ms][DBG ][CELL]: Device ready => SIM pin
[00012945ms][DBG ][CELL]: callback: 4106, err: 0, data: 4097
[00013024ms][INFO][CELL]: Setup SIM (timeout 1000 ms)
[00013096ms][DBG ][CELL]: AT flush
[00013148ms][INFO][CELL]: AT TX ( 8): AT+CPIN?
[00013213ms][INFO][CELL]: AT TX ( 1): <cr>
[00013273ms][INFO][CELL]: AT RX (22): <cr><ln>+CPIN: READY<cr><ln><cr><ln>OK<cr><ln>
[00013378ms][INFO][CELL]: SIM is ready
[00013434ms][DBG ][CELL]: callback: 4097, err: 0, data: 0
[00014510ms][INFO][CELL]: AT TX ( 7): AT+CIMI
[00014510ms][INFO][CELL]: AT TX ( 1): <cr>
[00014514ms][INFO][CELL]: AT RX (12): <cr><ln>2341012762
[00014514ms][INFO][CELL]: AT RX ( 2): 27
[00014514ms][INFO][CELL]: AT RX ( 2): 53
[00014558ms][INFO][CELL]: AT RX ( 9): 7<cr><ln><cr><ln>OK<cr><ln>
[00014642ms][INFO][CELL]: Looked up APN mobile.o2.co.uk
[00014716ms][DBG ][CELL]: Automatic network registration
[00014791ms][INFO][CELL]: AT TX ( 8): AT+COPS?
[00014856ms][INFO][CELL]: AT TX ( 1): <cr>
[00014916ms][INFO][CELL]: AT RX (32): <cr><ln>+COPS: 0,0,"O2 - UK",6<cr><ln><cr><ln>OK<cr><ln>
[00015031ms][DBG ][CELL]: STM: set_registration: 0, plmn: NULL
[00015112ms][INFO][CELL]: AT TX ( 9): AT+CGREG=
[00015177ms][INFO][CELL]: AT TX ( 1): 2
[00015235ms][INFO][CELL]: AT TX ( 1): <cr>
[00015295ms][INFO][CELL]: AT RX ( 6): <cr><ln>OK<cr><ln>
[00015370ms][INFO][CELL]: AT TX ( 8): AT+CREG=
[00015435ms][INFO][CELL]: AT TX ( 1): 2
[00015492ms][INFO][CELL]: AT TX ( 1): <cr>
[00015552ms][INFO][CELL]: AT RX ( 6): <cr><ln>OK<cr><ln>
[00015627ms][INFO][CELL]: AT TX ( 9): AT+CGACT?
[00015693ms][INFO][CELL]: AT TX ( 1): <cr>
[00015753ms][INFO][CELL]: AT RX ( 6): <cr><ln>OK<cr><ln>
[00015828ms][INFO][CELL]: AT TX ( 9): AT+CGATT?
[00015894ms][INFO][CELL]: AT TX ( 1): <cr>
[00015954ms][INFO][CELL]: AT RX (19): <cr><ln>+CGATT: 1<cr><ln><cr><ln>OK<cr><ln>
[00016056ms][DBG ][CELL]: Cellular already attached.
[00016126ms][INFO][CELL]: AT TX (10): AT+CGEREP=
[00016193ms][INFO][CELL]: AT TX ( 1): 1
[00016250ms][INFO][CELL]: AT TX ( 1): <cr>
[00016311ms][INFO][CELL]: AT RX ( 6): <cr><ln>OK<cr><ln>
[00016386ms][DBG ][CELL]: SIM pin => Signal quality
[00016456ms][INFO][CELL]: AT TX ( 6): AT+CSQ
[00016518ms][INFO][CELL]: AT TX ( 1): <cr>
[00016578ms][INFO][CELL]: AT RX (20): <cr><ln>+CSQ: 15,3<cr><ln><cr><ln>OK<cr><ln>
[00016681ms][DBG ][CELL]: callback: 4104, err: 0, data: -1
[00016758ms][DBG ][CELL]: Signal quality => Registering network
[00016840ms][INFO][CELL]: AT TX ( 6): AT+CSQ
[00016902ms][INFO][CELL]: AT TX ( 1): <cr>
[00016963ms][INFO][CELL]: AT RX (20): <cr><ln>+CSQ: 15,3<cr><ln><cr><ln>OK<cr><ln>
[00017065ms][DBG ][CELL]: callback: 4104, err: 0, data: -1
[00017142ms][INFO][CELL]: RSSI -83 dBm
[00017198ms][DBG ][CELL]: callback: 4106, err: 0, data: 4098
[00017277ms][INFO][CELL]: AT TX ( 9): AT+CGREG?
[00017343ms][INFO][CELL]: AT TX ( 1): <cr>
[00017403ms][INFO][CELL]: AT RX (32): <cr><ln>+CGREG: 2,1,"5650","29A7DF4",2
[00017499ms][INFO][CELL]: AT RX ( 8): <cr><ln><cr><ln>OK<cr><ln>
[00017583ms][DBG ][CELL]: +CGREG: RegisteredHomeNetwork, LAC 22096, cell 43679220, UTRAN
[00017691ms][INFO][CELL]: Roaming 0 Registered 1
[00017758ms][DBG ][CELL]: callback: 4098, err: 0, data: 1
[00017834ms][INFO][CELL]: Registering network => Attaching network
[00017919ms][INFO][CELL]: AT TX ( 6): AT+CSQ
[00017982ms][INFO][CELL]: AT TX ( 1): <cr>
[00018042ms][INFO][CELL]: AT RX (20): <cr><ln>+CSQ: 15,3<cr><ln><cr><ln>OK<cr><ln>
[00018144ms][DBG ][CELL]: callback: 4104, err: 0, data: -1
[00018221ms][INFO][CELL]: RSSI -83 dBm
[00018277ms][DBG ][CELL]: callback: 4102, err: 0, data: 1
[00018353ms][INFO][CELL]: AT TX (11): AT+CGDCONT?
[00018421ms][INFO][CELL]: AT TX ( 1): <cr>
[00018482ms][INFO][CELL]: AT RX ( 6): <cr><ln>OK<cr><ln>
[00018557ms][INFO][CELL]: AT TX (11): AT+CGDCONT=
[00018624ms][INFO][CELL]: AT TX ( 1): 1
[00018682ms][INFO][CELL]: AT TX ( 1): ,
[00018739ms][INFO][CELL]: AT TX ( 1): "
[00018796ms][INFO][CELL]: AT TX ( 2): IP
[00018854ms][INFO][CELL]: AT TX ( 1): "
[00018912ms][INFO][CELL]: AT TX ( 1): ,
[00018969ms][INFO][CELL]: AT TX ( 1): "
[00019026ms][INFO][CELL]: AT TX (15): mobile.o2.co.uk
[00019098ms][INFO][CELL]: AT TX ( 1): "
[00019156ms][INFO][CELL]: AT TX ( 1): <cr>
[00019216ms][INFO][CELL]: AT RX ( 6): <cr><ln>OK<cr><ln>
[00019291ms][INFO][CELL]: New PDP context 1, type 1
[00019361ms][INFO][CELL]: Found PDP context 1
[00019424ms][INFO][CELL]: CellularContext PPP connect
[00019496ms][INFO][CELL]: AT TX (16): AT+CGDATA="PPP",
[00019569ms][INFO][CELL]: AT TX ( 1): 1
[00019626ms][INFO][CELL]: AT TX ( 1): <cr>
[00019687ms][INFO][CELL]: AT RX (19): <cr><ln>CONNECT 7200000<cr><ln>
[00019775ms][DBG ][CELL]: ppp_status_cb: event 0, ptr 3
[00019849ms][DBG ][CELL]: callback: 0, ptr: 3
[00021481ms][DBG ][CELL]: ppp_status_cb: event 0, ptr 1
[00021481ms][DBG ][CELL]: callback: 0, ptr: 1
[00021482ms][INFO][CELL]: CellularContext IP 10.148.63.160
Connection Established.
[00021482ms][DBG ][CELL]: process_oob, filehandle is not usable, return...
TCP: connected with echo.mbedcloudtesting.com server
TCP: Sent 4 Bytes to echo.mbedcloudtesting.com
Received from echo server 4 Bytes
TCPSocket.close() fails, code: 4
Sending and received data failed.
[00022846ms][INFO][CELL]: CellularContext disconnect()
[00022846ms][DBG ][CELL]: ppp_status_cb: event 0, ptr 2
[00022864ms][DBG ][CELL]: AT sync
[00022864ms][INFO][CELL]: AT TX ( 8): AT+CMEE?
[00022912ms][INFO][CELL]: AT TX ( 1): <cr>
[00023865ms][WARN][CELL]: AT timeout
[00023865ms][DBG ][CELL]: AT error -3012
[00023865ms][DBG ][CELL]: consume_to_tag not found
[00023865ms][DBG ][CELL]: AT stop tag not found
[00023865ms][DBG ][CELL]: AT error -3012
[00023902ms][WARN][CELL]: AT timeout
[00023956ms][DBG ][CELL]: AT error -3012
[00024015ms][DBG ][CELL]: consume_to_tag not found
[00024083ms][DBG ][CELL]: AT stop tag not found
[00024149ms][DBG ][CELL]: AT error -3012
[00024207ms][INFO][CELL]: AT TX ( 8): AT+CMEE?
[00024272ms][INFO][CELL]: AT TX ( 1): <cr>
[00024332ms][INFO][CELL]: AT RX (32): <cr><ln>NO CARRIER<cr><ln><cr><ln>+CGEV: ME DEACT
[00024441ms][INFO][CELL]: AT RX (32): "IP","10.148.63.160",1<cr><ln><cr><ln>+CME
[00024543ms][INFO][CELL]: AT RX (12): E: 1<cr><ln><cr><ln>OK<cr><ln>
[00024630ms][DBG ][CELL]: callback: 0, ptr: 2
[00024694ms][INFO][CELL]: cellular_callback: PPP mode and NSAPI_STATUS_DISCONNECTED
[00024797ms][DBG ][CELL]: AT sync
[00024848ms][INFO][CELL]: AT TX ( 8): AT+CMEE?
[00024913ms][INFO][CELL]: AT TX ( 1): <cr>
[00024973ms][INFO][CELL]: AT RX (18): <cr><ln>+CMEE: 1<cr><ln><cr><ln>OK<cr><ln>
[00025073ms][INFO][CELL]: CellularContext disconnected
Success. Exiting
I imagine the reason the modem doesn't power on is because there is no communication across the AT protocol. Check the correct pins are configured in the json.
Attaching the logs with json file .. using Dragion NB-iot shield quectel BG96
{ "config": { "sock-type": "UDP", "echo-server-hostname": { "help": "Echo server host name.", "value": "\"18.197.48.88\"" }, "echo-server-port": { "help": "Echo server port number.", "value": 5681 }, "echo-device-port": { "help" : "Echo device port number.", "value" : 5685 }, "echo-connect-id": { "help": "Echo connect id", "value": 3 }, "trace-level": { "help": "Options are TRACE_LEVEL_ERROR,TRACE_LEVEL_WARN,TRACE_LEVEL_INFO,TRACE_LEVEL_DEBUG", "macro_name": "MBED_TRACE_MAX_LEVEL", "value": "TRACE_LEVEL_INFO" } }, "target_overrides": { "*": { "target.network-default-interface-type": "CELLULAR", "mbed-trace.enable": true, "lwip.ipv4-enabled": true, "ppp.ipv4-enabled": true, "lwip.ipv6-enabled": true, "ppp.ipv6-enabled": true, "lwip.ethernet-enabled": false, "lwip.ppp-enabled": true, "lwip.tcp-enabled": true, "platform.stdio-convert-newlines": true, "platform.stdio-baud-rate": 9600, "platform.default-serial-baud-rate": 9600, "platform.stdio-buffered-serial": true, "cellular.debug-at": true, "cellular.use-apn-lookup": true, "nsapi.default-cellular-sim-pin": null, "nsapi.default-cellular-plmn": null, "nsapi.default-cellular-apn": "\"iot.1nce.net\"", "nsapi.default-cellular-username": null, "nsapi.default-cellular-password": null, "QUECTEL_BG96.tx": "D1", "QUECTEL_BG96.rx": "D0", "QUECTEL_BG96.provide-default": true
},
"DISCO_L496AG": {
"target.macros_add": [
"CELLULAR_DEVICE=STModCellular"
],
"target.components_add": ["STMOD_CELLULAR"],
"stmod_cellular.provide-default": "true"
}
}
}
OK, looks like you don't have communicatin between the board and the shield. I think you need to configure the QUECTEL_BG96. Look in https://github.com/ARMmbed/mbed-os/blob/master/connectivity/drivers/cellular/QUECTEL/BG96/mbed_lib.json for values you need to provide.
This doesn't look like an issue with the example though. I recommend the forums or if there's something wrong with BG96 the mbed-os repo.
@paul-szczepanek-arm thanks for your time. closing this issue.
changed the uart pins and edited the json as per the documentation. complete link to the previous issue can be found here.
https://github.com/ARMmbed/mbed-os-example-cellular/issues/217#issue-824624940
Do we need AT commands in the code? Or we just need to edit the json?