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

What is the optimal way to configure the modem?

Dear All,

I would like some advice with regards to the best practice with configuring and controlling the nRF9160 M1/NB1 connection.

When working with other modems, our approach, when connecting / registering, typically involves running a specific sequence / flow of AT commands to query and (if necessary) set a range of the connection parameters. These parameters include things such as operator profiles and settings, APN configuration, and band masks etc. We also check to see if the connection is still active before attempting to send any data. This includes querying the signal quality, and testing for an active EPS / PDP context and a valid IP address.

In the existing examples it seems that most of the connection setup seems to be handled automatically, with some parameter control available via the project configuration file.

I guess the main question is whether it is recommended to allow the modem to handle the connection setup automatically, or should we attempt to control that in more detail. Similarly, to what extent should we be concerned with the maintenance of the registration/network connection or is this also handled robustly by the modem firmware / stack?

Parents
  • In general, you don't need to modify the code, since mostly everything is handled by the modem and the lte_lc driver. But in some cases it is necessary to enable some configurations in order to be able to connect, also if you would like to implement some specific features you'll have to add some configs. I will try to cover it briefly down below. In order to implement any of the configurations described below, you should put it in the prj.conf file.

    You dont need to set the PDP context, it is handled in the modem firmware. The modem detects what kind of SIM card is used, and sets the connection parameters (APN etc..) according to the SIM cards requirements. Read more about it in this ticket. However, if you want to change the PDP context manually, you need to set CONFIG_LTE_PDP_CMD=y, and assign your specific parameters to CONFIG_LTE_PDP_CONTEXT.

    Regarding the band mask, you should lock the bands that are used by your operator, in order to make the connection go faster. After a connection happens, you read out your operators supported bands, and lock in those particular bands. This can be done by enabling (set =y) CONFIG_LTE_LOCK_BANDS and assign the bands to CONFIG_LTE_LOCK_BAND_MASK.

    You don't need to check if the connection is active before sending data, since this is handled by the drivers and the modem firmware, but you could do it if it's preferable. To check the signal strength, you have to run the command AT+CESQ. Here is an informative ticket about signal strength. If you would like to see the EPS/EDP context and IP address you run the command AT+CGDCONT

    Other things you may set

    If you want to save power, you can enable LTE eDRX. Set CONFIG_LTE_EDRX_REQ=y and assign type and value to respectively CONFIG_LTE_EDRX_REQ_ACTT_TYPE  and CONFIG_LTE_EDRX_REQ_VALUE.

    Sometimes, when you are having troubles with the modem, a modem trace may help you get to the bottom of it. It is done by setting CONFIG_BSD_LIBRARY_TRACE_ENABLED=y. Check out this blog post, which shows you how to get a modem trace using the Trace Collector app.

    Some networks does not support ePCO, and then you have to disable it by setting CONFIG_LTE_LEGACY_PCO_MODE=y, which will enable PCO instead. Read more about ePCO and PCO here and here.

    Take a look at the driver lte_lc.c and the function w_lte_lc_Init() to get a better understanding of how the modem is configured. Also, all the configurations mentioned in this post is used by this function.


    I have not covered everything here, but please ask if you want me to elaborate on something else, or if anything in this post is unclear.

    Best regards,

    Simon

    EDIT (9/24/2019):
    I would like to mention some other AT commands that gives you information about the modem and the connection, which you could run after a connection is established. The command AT%XMONITOR gives you information about the modem parameters, and AT+CEREG? gives you info about the network status.
Reply
  • In general, you don't need to modify the code, since mostly everything is handled by the modem and the lte_lc driver. But in some cases it is necessary to enable some configurations in order to be able to connect, also if you would like to implement some specific features you'll have to add some configs. I will try to cover it briefly down below. In order to implement any of the configurations described below, you should put it in the prj.conf file.

    You dont need to set the PDP context, it is handled in the modem firmware. The modem detects what kind of SIM card is used, and sets the connection parameters (APN etc..) according to the SIM cards requirements. Read more about it in this ticket. However, if you want to change the PDP context manually, you need to set CONFIG_LTE_PDP_CMD=y, and assign your specific parameters to CONFIG_LTE_PDP_CONTEXT.

    Regarding the band mask, you should lock the bands that are used by your operator, in order to make the connection go faster. After a connection happens, you read out your operators supported bands, and lock in those particular bands. This can be done by enabling (set =y) CONFIG_LTE_LOCK_BANDS and assign the bands to CONFIG_LTE_LOCK_BAND_MASK.

    You don't need to check if the connection is active before sending data, since this is handled by the drivers and the modem firmware, but you could do it if it's preferable. To check the signal strength, you have to run the command AT+CESQ. Here is an informative ticket about signal strength. If you would like to see the EPS/EDP context and IP address you run the command AT+CGDCONT

    Other things you may set

    If you want to save power, you can enable LTE eDRX. Set CONFIG_LTE_EDRX_REQ=y and assign type and value to respectively CONFIG_LTE_EDRX_REQ_ACTT_TYPE  and CONFIG_LTE_EDRX_REQ_VALUE.

    Sometimes, when you are having troubles with the modem, a modem trace may help you get to the bottom of it. It is done by setting CONFIG_BSD_LIBRARY_TRACE_ENABLED=y. Check out this blog post, which shows you how to get a modem trace using the Trace Collector app.

    Some networks does not support ePCO, and then you have to disable it by setting CONFIG_LTE_LEGACY_PCO_MODE=y, which will enable PCO instead. Read more about ePCO and PCO here and here.

    Take a look at the driver lte_lc.c and the function w_lte_lc_Init() to get a better understanding of how the modem is configured. Also, all the configurations mentioned in this post is used by this function.


    I have not covered everything here, but please ask if you want me to elaborate on something else, or if anything in this post is unclear.

    Best regards,

    Simon

    EDIT (9/24/2019):
    I would like to mention some other AT commands that gives you information about the modem and the connection, which you could run after a connection is established. The command AT%XMONITOR gives you information about the modem parameters, and AT+CEREG? gives you info about the network status.
Children
No Data
Related