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

AWS IoT how change the messagge type 1?

Hello 

I'm using nRF910 DK and need to transmit to aws iot core just like the sample aws iot does, but instead of battery voltage I need to transmit gps data.

In sample I don't find where change the value of type 1 mesagge to transmit, I look for it in the code but I can't find the function in charge of this.

thanks in advance for your help 

Julio

Parents
  • Hi!

    Here are the relevant lines when modifying what message to post to AWS IoT. 

    In L108-L109, the data (battery voltage and date and time) is added to the JSON objects. Here is where you would instead add the GPS data.

    Then the object is made into a message string in L118.

    L125-L130 is where the struct that is used to transmit packages in the AWS IoT library is created. 

    And it is published in L134.

    You will also need to add GPS functionality in the sample, as this is not included. Use the GPS sample in NCS as a reference. Remember that GPS and LTE cannot work concurrently so you will either need to put the modem in PSM mode or turn it off before activating the GPS. 

    Best regards,

    Heidi

  • Hi Heidi!

    I can see the errors thanks for that, now analazing the aws_iot sample to know how implement PSM or eDRX mode and I don´t undestand the work_init() function, how works k_delayed_work_init()?

    I undertand that in main.c transmition is in L497, but just after this line can I put LTE modem in PSM or eDRX mode and then activate GPS?   

    edition I: I don't undertand what nrf_modem_lib_dfu_handler() does and what is the meaninig of this #define MODEM_DFU_RESULT_OK 0x5500001u?

    edition II: how I can find the errors meaning? i.e. this function lte_lc_func_mode_get() return -22, but I can't find its meaning

  • Hi!

    work_init() initializes three delayed work items (shadow_update_work, connect_work and shadow_update_version_work) prior to their first use (see: Zephyr: Submitting a Delayed Work Item). 

    nrf_modem_lib_dfu_handler() initializes the nRF Modem Libary (formerly called BSD Lib) which is the library used to run the modem on the nRF9160 SiP (see nrf_modem_lib.h#L24-L48 for a full description). It then has a switch case for the error code from the function. Lastly, it initializes the AT Cmd and AT Notif libraries. 

    I linked the meaning of the errors in my previous comment. EINVAL (22) is invalid argument. If you want to know why that function is returning this, you can take a look at where it is used in the code and the function definition (see lte_lc.c#811-L1871).

    Looks like the sample already requests to set the modem in PSM mode (see main.c#L250), so you don't have to think about this. Try integrating a GPS handler and GPS init function like in the AGPS sample.

Reply
  • Hi!

    work_init() initializes three delayed work items (shadow_update_work, connect_work and shadow_update_version_work) prior to their first use (see: Zephyr: Submitting a Delayed Work Item). 

    nrf_modem_lib_dfu_handler() initializes the nRF Modem Libary (formerly called BSD Lib) which is the library used to run the modem on the nRF9160 SiP (see nrf_modem_lib.h#L24-L48 for a full description). It then has a switch case for the error code from the function. Lastly, it initializes the AT Cmd and AT Notif libraries. 

    I linked the meaning of the errors in my previous comment. EINVAL (22) is invalid argument. If you want to know why that function is returning this, you can take a look at where it is used in the code and the function definition (see lte_lc.c#811-L1871).

    Looks like the sample already requests to set the modem in PSM mode (see main.c#L250), so you don't have to think about this. Try integrating a GPS handler and GPS init function like in the AGPS sample.

Children
Related