Hello
I would like to transmit gps data to my website in addition to nrf cloud, there is a example or documentation about this that I can take of reference? I am working with nRF 9160 DK
thanks in advance.
Kind Regards
Julio
Hello
I would like to transmit gps data to my website in addition to nrf cloud, there is a example or documentation about this that I can take of reference? I am working with nRF 9160 DK
thanks in advance.
Kind Regards
Julio
Hi,
The asset_tracker shows how to connect to a cloud based system, and send certain sensors + gps data to the cloud.
If you want a simpler solution, like a tcp/udp connection directly to your own server, I would recommend that you look at the "gps" sample, and add your own implementation around this.
Note that there's a restriction towards getting GPS and LTE concurrent, which is that you have to be in eDRX or PSM mode in order to use the GPS. A recommended use-case is to use the AT CSCON event to signal when you can or cannot use the GPS.
Kind regards,
Håkon
Thx Håkon,
I tried setting CSCON=0 when initialising the GPS.
(After looking at the code in asset_tracker I also saw it use lte_lc_psm_req(true))
If I then try to initialise a UDP connection lte_lc_init_and_connect_async(lte_handler) fails.
(Initialisation code from the UDP example)
I'm not clear on the sequence I need to initialise both GPS and UDP.
further...
I wanted to see why lte_lc_init_and_connect_async is failing but this seems to be part of the distribution that is shipped in binary.
Specifically, the error is:
modem_configure()
I: Using legacy LTE PCO mode...
I: PDP Context: AT+CGDCONT=0,"IP","lpwa.vodafone.iot"
E: Could not send AT command, error: -8
Which is odd because when initialising the GPS we already sent 4 AT commands without error.
This part of UDP initialisation works fine if I comment out the GPS initialisation
Thx.
You can evaluate the gps without using LTE, by running the "gps" example.
This doesn't require LTE, but does require that you're outside (or the GPS-antenna shall be outside) while testing.
Kind regards,
Håkon
Thx Håkon
Yes. The first thing I did was to test both GPS and UDP examples.
Only then did I try to put them together to make a minimal tracker using UDP and without the need for all the other good stuff in your asset_tracker app.
So I now wait for udp Idle.
However, from the code in the gps sample I then get an error from
```
at_cmd_write(at_commands[i])
```
AT_XSYSTEMMODE, (fails on this one)
AT_MAGPIO,
AT_COEX0,
AT_ACTIVATE_GPS
so GPS is not activated.
XSYSTEMMODE is probably redundant but why would it throw an error?
Regards.
Hi,
paul_tanner said:XSYSTEMMODE is probably redundant but why would it throw an error?
Its highly likely because the modem is already enabled (AT+CFUN=1) at this point. Please check that "modem_configure()" isn't called, and that "CONFIG_LTE_AUTO_INIT_AND_CONNECT=n" is set in your project.
Kind regards,
Håkon
Thx Håkon
modem_configure() *was* being called; CONFIG_LTE_AUTO_INIT_AND_CONNECT=n is set.
So I removed modem_configure(). The result was that we never get the LTE_LC_EVT_RRC_UPDATE (idle) event so it just hangs.
Is something else needed instead of modem_configure()? (per the udp example)
Presumably the lack of modem_configure would also prevent sending of data via udp?
Regards.
Hi Paul,
My strongest apologies! This comment from me is written a bit too fast (ie: its wrong..)
Håkon Alseth said:Please check that "modem_configure()" isn't called
You should check that modem_configure hasn't been called yet, before setting system permissions, like XSYSTEMMODE.
So, issue your AT-commands, then call modem_configure() to connect to the LTE network.
Kind regards,
Håkon
Hi Paul,
My strongest apologies! This comment from me is written a bit too fast (ie: its wrong..)
Håkon Alseth said:Please check that "modem_configure()" isn't called
You should check that modem_configure hasn't been called yet, before setting system permissions, like XSYSTEMMODE.
So, issue your AT-commands, then call modem_configure() to connect to the LTE network.
Kind regards,
Håkon
Thx Håkon
I tried that. It gets to modem_configure() - same code as in UDP sample - and we then fail with:
```
Could not send AT command error -8
```
This is happening inside lte_lc_init_and_connect_async() for which AFAIK we do not have the source.
Regards.
Hi,
paul_tanner said:This is happening inside lte_lc_init_and_connect_async() for which AFAIK we do not have the source.
That function is inside lte_lc.c: https://github.com/nrfconnect/sdk-nrf/blob/master/lib/lte_link_control/lte_lc.c#L744
Do you know which AT command is failing? Does any of them work?
Kind regards,
Håkon
Thx Håkon
OK. modem_configure() is trying to set the AT%XSYSTEMMODE - which is *already* correctly set.
(I have CONFIG_LTE_NETWORK_MODE_NBIOT_GPS=y in prj.conf)
BTW. To find this out I had to edit lte_lc.c whereas I would have preferred to turn on debugging. I tried adding:
#define NRF_AT_CMD_LOG_LEVEL NRF_LOG_LEVEL_DEBUG
in main.c but that had no effect.
What next?
Regards.
So I made that error in modem_configure() non-fatal (a hack in ltc_lc.c) and it now does GPS and transmits the result via UDP. This is almost a solution apart from the fact that I hacked ltc_lc.c. I'd like a way to do this without that hack if possible to make it more upgrade-proof.
Also, if I want to restrict the log a bit i'd like to find out where CONFIG_LTE_LINK_CONTROL_LOG_LEVEL is defined.
Thx for any suggestions.
Regards
Hi,
Don't change the source files, you should set the log level on a project level:
https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LOG_DEFAULT_LEVEL.html
You can access this by entering "menuconfig", either via SeggerEmbeddedStudio (nordic edition) or via command line (cd my-project/build-folder && ninja menuconfig)
Then you should also choose "LTE_LINK_CONTROL_LOG_LEVEL_DBG".
Kind regards,
Håkon