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!

    So, you can find the documentation for the %XMONITOR AT Command here. From your result, we see 

    Active-Time: 11100000 - deactivated

    Periodic-TAU-ext: 11100000 - deactivated

    Periodic-TAU: 01001001 - 36 minutes

     

    tracking said:
    which one is the modification? I had undertood that with this line (L348) the modem change to psm o mode idle when the pakage was transmitted and in this condition the gps can work.

     Yes, L348 is the modification you need to add to the modem_configure() function in the AWS IoT sample to request PSM. And preferably the following four lines to catch any errors. 

    tracking said:
    yes, I include gps driver, but I don't know what cosiderations I must have with Cmakelists, Kconfig, prj.conf and other files 

     Then you go into these files in the AGPS sample and you see if there are any GPS-related considerations that you should include in your sample. prj.conf L52 adds CONFIG_NRF9160_GPS=y to enable the GPS driver so you should include this as well. 

  • Hi!

    I read this documentation, but I stil without undertand these times:

    Active-Time: 11100000 - deactivated

    Periodic-TAU-ext: 11100000 - deactivated

    Periodic-TAU: 01001001 - 36 minutes

    which function have each of them?

    can I control them?

    there are any relation whit these values? (autoconf.h agps sample)

    other question, in aws_iot sample I modified the time between publications to 300 (kconfig file), but the modem stil change connect and idle mode each 60 seconds, what more must I change to give more time to gps?

    thanks in advance

  • tracking said:
    which function have each of them?

     The active timer determines the duration during which the device remains reachable for mobile terminated transactions on the transition from connected to idle mode.

    The periodic TAU timer determines how often the device will send a periodic tracking update to the network

    The extended periodic TAU timer just allows for a longer periodic TAU timer. 

    tracking said:
    can I control them?

     You can request values from the network using +CPSMS but the network can give you different values than what you requested. 

    tracking said:
    there are any relation whit these values?

     Yes, LTE_PSM_REQ_RPTAU is the requested periodic TAU and LTE_PSM_REQ_RAT is the requested active time. 

    tracking said:
    other question, in aws_iot sample I modified the time between publications to 300 (kconfig file), but the modem stil change connect and idle mode each 60 seconds, what more must I change to give more time to gps?

     60 seconds? From the %XMONITOR results, it says the periodic TAU is 36 minutes? Did you change these configurations?

    You will need to change the PSM configurations to give more time to the GPS.

  • Hi Heidi!

    I proved the AT%XMONITOR with my code and show me this values:

    I understand that 

    active time: "00000010" means four seconds to pass of connected mode to idle mode

    periodic tau ext: "00011111" means 10 minutes x 31 = 310 minutes, I don´t understand with accuracy what controls this time

    periodic tau: "01011111" means 10 hours x 31 = 310 hours, this time is the time between ubication updates of modem, but this update is't a message to cloud it is only to network knows the modem location

    Other question 

    When I run the example, this happens:

     RRC mode: Connected

    //aproximatly after 4 seconds

    RRC mode: Idle

    // aproximatly after 60 seconds

    RRC mode: Connected

    and so on, but gps don't active in any time

    how can I control the time between Idle and Conneted mode (in this case 60 seconds)?

    The two last lines belong to agps example and I added to work init function in aws_iot sample, I undertand that in this code there are five threads, three for aws and two for gps control, is this correct?

    thanks!

  • Hi! I see. 

    This is a bit out of my expertise and also very unrelated to your original inquiry. Could you please make a new ticket about this and you will be assigned an engineer who can answer it. 

    Best regards,

    Heidi

Reply Children
Related