bifravst / cat-tracker-fw

Cat Tracker Firmware
https://bifravst.github.io/
3 stars 3 forks source link

dev is not published #39

Closed coderbyheart closed 4 years ago

coderbyheart commented 4 years ago

It seems dev is only published once, the very first time the device connects, but not after a reboot. In this case I changed the FW to LTE-m and would have expected the dev to be updated with the new network mode, but it does not publish it.

[2019-11-14 15:06:08] ***** Booting Zephyr OS build v2.0.99-ncs1-rc1-11-g9be97c63368a *****
[2019-11-14 15:06:08] [00:00:00.417,144] <dbg> nrf9160_gps.init: MAGPIO set: AT%XMAGPIO=1,0,0,1,1,1574,1577
[2019-11-14 15:06:08] [00:00:00.426,025] <dbg> nrf9160_gps.init: COEX0 set: AT%XCOEX0=1,1,1570,1580
[2019-11-14 15:06:08] The cat tracker has started
[2019-11-14 15:06:08] Version: v0.31.0
[2019-11-14 15:06:08] Connecting to LTE network. This may take several minutes.
[2019-11-14 15:07:39] rsrp value is 60
[2019-11-14 15:07:39] [00:01:31.933,654] <err> lte_lc: Invalid CEREG response
[2019-11-14 15:07:39] [00:01:31.939,727] <err> lte_lc: Could not get network registration status
[2019-11-14 15:07:39] rsrp value is 65
[2019-11-14 15:07:39] [00:01:31.955,963] <err> lte_lc: Invalid CEREG response
[2019-11-14 15:07:39] [00:01:31.962,066] <err> lte_lc: Could not get network registration status
[2019-11-14 15:07:41] rsrp value is 70
[2019-11-14 15:07:41] [00:01:33.356,140] <err> lte_lc: Invalid CEREG response
[2019-11-14 15:07:41] [00:01:33.362,213] <err> lte_lc: Could not get network registration status
[2019-11-14 15:07:41] LTE connected!
[2019-11-14 15:07:41] Fetching modem time...
[2019-11-14 15:07:42] 14/10/19,14:7:41
[2019-11-14 15:07:42] Device get binding device
[2019-11-14 15:07:42] GPS initialized
[2019-11-14 15:07:42] Enabling PSM
[2019-11-14 15:07:42] PSM enabled
[2019-11-14 15:07:43] [00:01:35.357,116] <dbg> bifravst_cloud.broker_init: IPv4 Address found 3.120.47.87
[2019-11-14 15:07:43] [00:01:36.159,332] <dbg> nrf9160_gps.enable_gps: GPS mode is not enabled, attempting to enable it
[2019-11-14 15:07:43] [00:01:36.168,914] <dbg> nrf9160_gps.enable_gps: Sending AT command: AT%XSYSTEMMODE=0,1,0,1
[2019-11-14 15:07:43] [00:01:36.178,375] <err> nrf9160_gps: Could not enable GPS mode, error: -8
[2019-11-14 15:07:43] [00:01:36.186,157] <err> nrf9160_gps: Failed to enable GPS
[2019-11-14 15:07:43] Failed starting GPS!
[2019-11-14 15:07:43] GPS could not be started, error: -5
[2019-11-14 15:08:42] [00:02:35.155,731] <dbg> nrf9160_gps.stop: Stopping GPS
[2019-11-14 15:08:42] [00:02:35.161,529] <err> nrf9160_gps: Failed to stop GPS
[2019-11-14 15:08:42] GPS could not be stopped, error: -5
[2019-11-14 15:09:42] REGISTERED TO ROAMING NETWORK
[2019-11-14 15:09:42] Encoded message: {
[2019-11-14 15:09:42]   "state":        {
[2019-11-14 15:09:42]           "reported":     {
[2019-11-14 15:09:42]                   "bat":  {
[2019-11-14 15:09:42]                           "v":    4250,
[2019-11-14 15:09:42]                           "ts":   1573740581025
[2019-11-14 15:09:42]                   }
[2019-11-14 15:09:42]           }
[2019-11-14 15:09:42]   }
[2019-11-14 15:09:42] }
[2019-11-14 15:09:42] [00:03:35.187,774] <dbg> bifravst_cloud.data_publish: Publishing to topic: $aws/things/352656100005076/shadow/update
[2019-11-14 15:09:43] [00:03:35.735,107] <err> bifravst_cloud: mqtt_connect, error: -22
[2019-11-14 15:09:43] cloud_connect failed: -22
[2019-11-14 15:09:43] Cloud send failed, err: -128
[2019-11-14 15:09:43] Encoded message: {
[2019-11-14 15:09:43]   "state":        {
[2019-11-14 15:09:43]           "reported":     {
[2019-11-14 15:09:43]                   "roam": {
[2019-11-14 15:09:43]                           "v":    {
[2019-11-14 15:09:43]                                   "rsrp": 70,
[2019-11-14 15:09:43]                                   "area": 30401,
[2019-11-14 15:09:43]                                   "mccmnc":       24201,
[2019-11-14 15:09:43]                                   "cell": 21627653,
[2019-11-14 15:09:43]                                   "ip":   "10.160.56.208"
[2019-11-14 15:09:43]                           },
[2019-11-14 15:09:43]                           "ts":   1573740581626
[2019-11-14 15:09:43]                   }
[2019-11-14 15:09:43]           }
[2019-11-14 15:09:43]   }
[2019-11-14 15:09:43] }
[2019-11-14 15:09:43] [00:03:35.800,994] <dbg> bifravst_cloud.data_publish: Publishing to topic: $aws/things/352656100005076/shadow/update
[2019-11-14 15:09:43] Cloud send failed, err: -128
[2019-11-14 15:09:43] Enabling PSM
[2019-11-14 15:09:43] PSM enabled
[2019-11-14 15:09:44] [00:03:36.825,775] <dbg> nrf9160_gps.enable_gps: GPS mode is not enabled, attempting to enable it
[2019-11-14 15:09:44] [00:03:36.835,357] <dbg> nrf9160_gps.enable_gps: Sending AT command: AT%XSYSTEMMODE=0,1,0,1
[2019-11-14 15:09:44] [00:03:36.844,848] <err> nrf9160_gps: Could not enable GPS mode, error: -8
[2019-11-14 15:09:44] [00:03:36.852,630] <err> nrf9160_gps: Failed to enable GPS
[2019-11-14 15:09:44] Failed starting GPS!
[2019-11-14 15:09:44] GPS could not be started, error: -5
[2019-11-14 15:10:09] rsrp value is 64
[2019-11-14 15:10:09] rsrp value is 71
[2019-11-14 15:10:43] [00:04:35.816,558] <dbg> nrf9160_gps.stop: Stopping GPS
[2019-11-14 15:10:43] [00:04:35.822,326] <err> nrf9160_gps: Failed to stop GPS
[2019-11-14 15:10:43] GPS could not be stopped, error: -5
[2019-11-14 15:11:43] REGISTERED TO ROAMING NETWORK
[2019-11-14 15:11:43] Encoded message: {
[2019-11-14 15:11:43]   "state":        {
[2019-11-14 15:11:43]           "reported":     {
[2019-11-14 15:11:43]                   "bat":  {
[2019-11-14 15:11:43]                           "v":    4281,
[2019-11-14 15:11:43]                           "ts":   1573740701700
[2019-11-14 15:11:43]                   }
[2019-11-14 15:11:43]           }
[2019-11-14 15:11:43]   }
[2019-11-14 15:11:43] }
[2019-11-14 15:11:43] [00:05:35.862,579] <dbg> bifravst_cloud.data_publish: Publishing to topic: $aws/things/352656100005076/shadow/update
[2019-11-14 15:11:43] Cloud send failed, err: -128
[2019-11-14 15:11:43] Encoded message: {
[2019-11-14 15:11:43]   "state":        {
[2019-11-14 15:11:43]           "reported":     {
[2019-11-14 15:11:43]                   "roam": {
[2019-11-14 15:11:43]                           "v":    {
[2019-11-14 15:11:43]                                   "rsrp": 71,
[2019-11-14 15:11:43]                                   "area": 30401,
[2019-11-14 15:11:43]                                   "mccmnc":       24201,
[2019-11-14 15:11:43]                                   "cell": 21627653,
[2019-11-14 15:11:43]                                   "ip":   "10.160.56.208"
[2019-11-14 15:11:43]                           },
[2019-11-14 15:11:43]                           "ts":   1573740701857
[2019-11-14 15:11:43]                   }
[2019-11-14 15:11:43]           }
[2019-11-14 15:11:43]   }
[2019-11-14 15:11:43] }
[2019-11-14 15:11:43] [00:05:36.031,311] <dbg> bifravst_cloud.data_publish: Publishing to topic: $aws/things/352656100005076/shadow/update
[2019-11-14 15:11:43] Cloud send failed, err: -128
[2019-11-14 15:11:43] Enabling PSM
[2019-11-14 15:11:43] PSM enabled
[2019-11-14 15:11:44] [00:05:37.056,213] <dbg> nrf9160_gps.enable_gps: GPS mode is not enabled, attempting to enable it
[2019-11-14 15:11:44] [00:05:37.065,765] <dbg> nrf9160_gps.enable_gps: Sending AT command: AT%XSYSTEMMODE=0,1,0,1
[2019-11-14 15:11:44] [00:05:37.075,256] <err> nrf9160_gps: Could not enable GPS mode, error: -8
[2019-11-14 15:11:44] [00:05:37.083,038] <err> nrf9160_gps: Failed to enable GPS
[2019-11-14 15:11:44] Failed starting GPS!
[2019-11-14 15:11:44] GPS could not be started, error: -5
simensrostad commented 4 years ago

Device data is included in a publish sequence that occurs only when the device connects to the "cloud". In the log this event prints as CLOUD_EVT_CONNECTED, which seems to not have occurred. This event is propagated through the generic cloud api when a mqtt connack occurs.

coderbyheart commented 4 years ago

Ah, I see! The device was not connected:

[2019-11-14 15:11:43] Cloud send failed, err: -128