This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf9160 lte send data in gps continuous mode immediately

Hi,
with my nrf9160 I need to send a gps location every 3 sec to azure, so I combined the agps and the azure iot hub sample.
It's working pretty good but 10 sec as a periodic interval for the gps samples is to high (especially since it's more like 14 sec).

I experimented with continuous mode, so that it gets a location every 1 sec and sends it to azure. But it seems, that it got sent in batches.
Every 16th location sample, he pauses at D: (0x20022f08): [0x200235f0]: Transport writing message. (MQTT log), all gets sent and he starts over (until the 15-17 sample is reached).

When he trys to send, the log looks like the following:

D: (0x20022f08): [0x200235f0]: Transport writing message.
+CSCON: 1
D: (0x20022f08): [0x200235f0]: Transport write complete.

The CSCON: 1 only appears when he sends the data.

It should be:

Get GPS position
Send to Azure
Get GPS position
Send to Azure
.
.

But it seems to be:

Get GPS position
Get GPS position
Get GPS position
Get GPS position
.
.
Send to Azure

Is there any way to send gps data in continuous mode immediately when I call azure_iot_hub_send ?

I guess the lte doesnt get time to send the data, but how can I ensure that the order is GPS, LTE, GPS, LTE... ?

Best regards

Update: I'm currently using the gps sample, where the switching between lte and gps done manually, but it seems to be slower since it needs to reconnect every time I call activate_lte (besides, after 8 to 15 calls it hangs at  k_sem_take(&lte_ready, K_FOREVER); for 1 hour then the CERREG: 5 finnaly comes. Could this be that my provider blocks me since I connect and disconenct so often?).

I tried to also set PSM mode by calling t_cmd_write("AT+CPSMS=1,,,\"00000110\",\"00000001\""NULL0NULL); in activate_lte, but now when i leave LTE and GPS activated it just crashes when sending the position through LTE.

Is there any better way?

  • Hi, and sorry for the very late answer.

    How did you integrate GPS into the Azure sample?

    Do you have any logs or a modem trace?

     If you could get a log which is also showing AT+CSCON notifications, that would be very helpful.

    but it seems to be slower since it needs to reconnect every time I call activate_lte

     The GPS sample is made to test the GPS, and the GPS works best when LTE is disabled. The LTE stack has priority over the GPS stack, so if LTE is enabled, the GPS stack might not get enough time to run in order to download all the necessary data from the satellites.

    This can be somewhat helped by AGPS, or by using eDRX or PSM to give the GPS more time to run.

     

    besides, after 8 to 15 calls it hangs at  k_sem_take(&lte_ready, K_FOREVER); for 1 hour then the CERREG: 5 finnaly comes. Could this be that my provider blocks me since I connect and disconenct so often?

     Yes, e.g. there is a limit of only 30 connection requests per hour.

     

    I tried to also set PSM mode by calling t_cmd_write("AT+CPSMS=1,,,\"00000110\",\"00000001\""NULL0NULL); in activate_lte, but now when i leave LTE and GPS activated it just crashes when sending the position through LTE.

     That sounds strange. Do you have any logs to indicate where the crash occurs?

    Also, a better way would be to set CONFIG_LTE_PSM_REQ_RAT and CONFIG_LTE_PSM_REQ_RPTAU.

    Best regards,

    Didrik

Related