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

Get GPS and send it to MQTT Broker

Hi,

I'm quiet new with nrf9160.


I try to mix the two sample GPS and MQTT to send my position each time it change to a MQTT broker.

I have create two threads, one for the MQTT and the second for get the GPS position.

How to setup the modem to use MQTT (LTE) and GPS.
If I use the GPS setup from the example, I get each time an error (-8) when I send the AT%XSYSTEMMODE command.

Exist it some example of this application?

Thank you

Thomas

Parents
  • Hi Thomas,

    Could you please provide the full serial output log?

    The best way would be to combine the samples as you are trying to do but keep two separate threads one working with the MQTT handling and one for the GPS so you do not get any blocking issues.
    The GPS samples turn the modem off switch, modes, turns it ON, work, turn OFF, Switch modes if you have enabled the SUPL library to download the A-GPS data.
    However instead of turning the modem OFF and ON all the time it is better to enable PSM mode or extend the eDRX interval so you can have LTE and GPS more or less working "concurrently".
    Then you do not need to detach and reattach to the network each time you need to send info to the web.

    By the way which network, SIM card and technology are you using? (LTEM or nbiot?)

Reply
  • Hi Thomas,

    Could you please provide the full serial output log?

    The best way would be to combine the samples as you are trying to do but keep two separate threads one working with the MQTT handling and one for the GPS so you do not get any blocking issues.
    The GPS samples turn the modem off switch, modes, turns it ON, work, turn OFF, Switch modes if you have enabled the SUPL library to download the A-GPS data.
    However instead of turning the modem OFF and ON all the time it is better to enable PSM mode or extend the eDRX interval so you can have LTE and GPS more or less working "concurrently".
    Then you do not need to detach and reattach to the network each time you need to send info to the web.

    By the way which network, SIM card and technology are you using? (LTEM or nbiot?)

Children
Related