Connect to nRF cloud using eSIM.

We are using nRF9160 chip (in own custom board), SDK 1.9.1 board with "serial lte modem" firmware.
We are unable to get coordinates using AGPS.
I suppose this is due to the fact that the eSIM needs to be somehow registered on the nRF Cloud.
We used the sequence of commands from the "GNSS_AT_commands" example:

  AT%XSYSTEMMODE=1,0,1,0

  OK
  AT%XCOEX0=1,1,1565,1586

  OK
  AT+CPSMS=1

  OK
  AT+CFUN=1

  OK
  AT#XNRFCLOUD=1

  OK

  AT#XAGPS=1,1
  ERROR
  
  AT#XNRFCLOUD?
  #XNRFCLOUD: 0,0,16842753,"nrf-350916060695718" 


But there is no connection to the nRF cloud. eSIM is already used to upload / unload  data via MQTT using AT commands, so the SIM card is working.

Parents
  • Dear :

    Let's go through the entire scenario from the beginning.
    Because at some stage there is definitely a problem.

    We are using "serial_lte_modem" firmware, using an external MCU and indicating that we are using our Security tag:
    CONFIG_NRF_CLOUD_AGPS=y
    CONFIG_SLM_CONNECT_UART_2=y
    CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
    CONFIG_SLM_AGPS=y
    CONFIG_NRF_CLOUD_SEC_TAG=321

    prj.conf file: 

    #
    # Copyright (c) 2020 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    # General config
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_STACK_SENTINEL=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_RING_BUFFER=y
    
    # Segger RTT
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_LOG_BACKEND_RTT=n
    CONFIG_LOG_BACKEND_UART=y
    
    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_NATIVE=n
    
    # Modem library
    CONFIG_NRF_MODEM_LIB=y
    # Align the max FD entry to NRF_MODEM_MAX_SOCKET_COUNT(8)
    CONFIG_POSIX_MAX_FDS=8
    # Enable below for modem trace
    #CONFIG_NRF_MODEM_LIB_TRACE_ENABLED=y
    
    # Use GPIO
    CONFIG_GPIO=y
    CONFIG_GPIO_NRFX=y
    
    # UART interface
    CONFIG_SERIAL=y
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_TIMER2=y
    
    # Stacks and heaps
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    
    # Device power management
    CONFIG_PM_DEVICE=y
    
    # FOTA
    CONFIG_HTTP_PARSER_URL=y
    CONFIG_FOTA_DOWNLOAD=y
    CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
    CONFIG_DFU_TARGET=y
    CONFIG_DOWNLOAD_CLIENT=y
    CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_IMG_MANAGER=y
    
    # FLASH
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    # Settings
    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_FCB=y
    CONFIG_FCB=y
    
    # nRF Cloud
    CONFIG_CLOUD_API=y
    CONFIG_NRF_CLOUD_MQTT=y
    CONFIG_NRF_CLOUD_FOTA=n
    CONFIG_NRF_CLOUD_AGPS=y
    CONFIG_NRF_CLOUD_PGPS=y
    CONFIG_NRF_CLOUD_CELL_POS=y
    CONFIG_NRF_CLOUD_LOG_LEVEL_INF=y
    CONFIG_DATE_TIME=y
    CONFIG_MODEM_INFO=y
    CONFIG_MODEM_INFO_ADD_DATE_TIME=n
    CONFIG_AT_MONITOR=y
    CONFIG_MODEM_JWT=y
    # Use "nrf-<IMEI>" as the default device_id format
    # Use "<device_uuid>" as the device_id format by below
    #CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=y
    
    #
    # SLM-specific configurations
    #
    CONFIG_SLM_CUSTOMIZED=n
    CONFIG_SLM_LOG_LEVEL_INF=y
    CONFIG_SLM_EXTERNAL_XTAL=n
    CONFIG_SLM_START_SLEEP=n
    #\nUse\nUART_0\n(when\nworking\nwith\nPC\nterminal)
    #CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
    #\nUse\nUART_2\n(when\nworking\nwith\nexternal\nMCU)
    CONFIG_SLM_CONNECT_UART_2=y
    CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
    #\nnRF\nCloud\nbased\nlocation\nservices
    CONFIG_SLM_AGPS=y
    CONFIG_SLM_PGPS=y
    CONFIG_SLM_CELL_POS=y
    CONFIG_SLM_LOG_LEVEL_DBG=y
    CONFIG_NRF_CLOUD_LOG_LEVEL_DBG=y
    CONFIG_NRF_CLOUD_SEC_TAG=321
    

    nrf9160dk_nrf9160_ns.conf file:

    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # Configuration file for nRF9160DK.
    # This file is merged with prj.conf in the application folder, and options
    # set here will take precedence if they are present in both files.
    
    # Use UART_0 (when working with PC terminal)
    # unmask the following config
    #CONFIG_SLM_CONNECT_UART_0=y
    #CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
    #CONFIG_UART_0_NRF_HW_ASYNC=y
    #CONFIG_SLM_INTERFACE_PIN=6
    
    # Use UART_2 (when working with external MCU)
    # unmask the following config
    CONFIG_SLM_CONNECT_UART_2=y
    CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
    CONFIG_UART_2_NRF_HW_ASYNC=y
    CONFIG_SLM_INTERFACE_PIN=31

    When starting the device, we execute the following commands to install our certificates:

    AT%CMNG=0,321,0, ...
    OK

    AT%CMNG=0,321,1, ...
    OK

    AT%CMNG=0,321,2, ...
    OK

    AT%CMNG=0,321,1, ...


    Results of the AT%CMNG=1 command:

    %CMNG: 0,6,"0606060606060606060606060606060606060606060606060606060606060606"
    %CMNG: 321,0,"0000000000000000000000000000000000000000000000000000000000000000"
    %CMNG: 321,1,"0101010101010101010101010101010101010101010101010101010101010101"
    %CMNG: 321,2,"0202020202020202020202020202020202020202020202020202020202020202"
    %CMNG: 654321,0,"000000000000000000000000000000000000000000000000000000000000000
    0"
    %CMNG: 654321,1,"010101010101010101010101010101010101010101010101010101010101010
    1"
    %CMNG: 654321,2,"020202020202020202020202020202020202020202020202020202020202020
    2"
    %CMNG: 4294967293,10,"0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A
    0A0A0A"
    %CMNG: 4294967292,11,"0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B
    0B0B0B"
    OK

    I see that there is no data for tag 16842753.
    As I understand it, we do not have certificates for accessing the nRF cloud. How can we get them back?

    Next, we execute a sequence of commands to use AGPS (from the GNSS_AT_commands.rst example):

    AT%XSYSTEMMODE=1,0,1,0

    OK
    AT%XCOEX0=1,1,1565,1586

    OK
    AT+CPSMS=1

    OK
    AT+CFUN=1

    OK
    AT#XNRFCLOUD=1

    OK

    Receiving in response:

    #XNRFCLOUD: 0,0

    #XNRFCLOUD: 0,0

    How did you write:
    The first AT#XNRFCLOUD=1 command initiates the connection to the cloud. on the initial connection, the JITP step is performed and nRF Cloud immediately disconnects the device, hence the #XNRFCLOUD: 0,0 responses.

    After that, I try to add my user device to the nRF cloud using the user ID (not IMEI, used the device ID, the same one used when generating certificates) and any password as you said earlier:
    For you custom board you can choose a Device ID that fits your application along with a PIN/HWID of your choice.

    Any attempts to add a devay give an error code: Code 40412.

    Naturally, repeated execution of the AT#XNRFCLOUD=1 command does not give access to the cloud.

    What are we missing? Why we cannot registration the device in nRF Cloud? and continue to use AGPS?

  • Stas Jis said:

    AT#XNRFCLOUD?

    #XNRFCLOUD: 0,0,654321,"nrf-350916060695718"

    From your previous comment your showed that you have a certificate for nRF Cloud. Did you change in prj.conf the sec_tag to 321?
    CONFIG_NRF_CLOUD_SEC_TAG=321
    What happens if you change this to 654321 and retry? 


    Stas Jis said:
    After that, I try to add my user device to the nRF cloud using the user ID (not IMEI, used the device ID, the same one used when generating certificates) and any password as you said earlier:
    For you custom board you can choose a Device ID that fits your application along with a PIN/HWID of your choice.

    I've programmed the SLM application and tested generating the following certs

    Then using the certificate manager in LTE Link Monitor to provision to my nRF9160DK

    2022-04-07T09:52:58.347Z INFO Updating CA certificate...
    2022-04-07T09:52:58.348Z DEBUG modem >> AT%CMNG=0,321,0,"-----BEGIN CERTIFICATE-----
    2022-04-07T09:52:58.360Z DEBUG modem >> MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF
    ...
    2022-04-07T09:52:58.581Z DEBUG modem >> rqXRfboQnoZsG4q5WTP468SQvvG5
    2022-04-07T09:52:58.593Z DEBUG modem >> -----END CERTIFICATE-----"
    2022-04-07T09:52:59.989Z DEBUG modem << OK
    2022-04-07T09:52:59.990Z INFO Updating client certificate...
    2022-04-07T09:52:59.991Z DEBUG modem >> AT%CMNG=0,321,1,"-----BEGIN CERTIFICATE-----
    2022-04-07T09:53:00.003Z DEBUG modem >> MIICojCCAYoCCQCRSlfrvINUyjANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJO
    ...
    2022-04-07T09:53:00.177Z DEBUG modem >> 3M3LgJOd
    2022-04-07T09:53:00.188Z DEBUG modem >> -----END CERTIFICATE-----
    2022-04-07T09:53:00.202Z DEBUG modem >> -----BEGIN CERTIFICATE-----
    2022-04-07T09:53:00.214Z DEBUG modem >> MIIDszCCApugAwIBAgIJAIt6VMjGN2CzMA0GCSqGSIb3DQEBCwUAMHAxCzAJBgNV
    ...
    2022-04-07T09:53:00.450Z DEBUG modem >> jzV+sF0OhtHgMgnAkUUU05UCqi8gWuC+qtimwx80X+ETCq4jpGqj
    2022-04-07T09:53:00.462Z DEBUG modem >> -----END CERTIFICATE-----"
    2022-04-07T09:53:00.514Z DEBUG modem << OK
    2022-04-07T09:53:00.516Z INFO Updating private key...
    2022-04-07T09:53:00.518Z DEBUG modem >> AT%CMNG=0,321,2,"-----BEGIN EC PARAMETERS-----
    2022-04-07T09:53:00.532Z DEBUG modem >> BggqhkjOPQMBBw==
    2022-04-07T09:53:00.544Z DEBUG modem >> -----END EC PARAMETERS-----
    2022-04-07T09:53:00.555Z DEBUG modem >> -----BEGIN EC PRIVATE KEY-----
    2022-04-07T09:53:00.567Z DEBUG modem >> MHcCAQEEIAQgeXklbT8V93LOekZgK+zuKxTEiw4IFSz8Yg2pPG1BoAoGCCqGSM49
    2022-04-07T09:53:00.579Z DEBUG modem >> AwEHoUQDQgAEVZ8c8YzWCw/MSi85fJhVCv8h3eRFX7f4+WYoTutXX9MRyksPP6HA
    2022-04-07T09:53:00.704Z DEBUG modem >> C/RWEoj4NeNK5JM7uEq3eRdVMDh1eRLSuA==
    2022-04-07T09:53:00.725Z DEBUG modem >> -----END EC PRIVATE KEY-----"
    2022-04-07T09:53:00.825Z DEBUG modem << OK
    2022-04-07T09:53:00.826Z INFO Certificate update completed
    

    Then I run the following:

    2022-04-07T10:36:46.860Z DEBUG modem >> AT#XNRFCLOUD=1
    2022-04-07T10:36:46.865Z DEBUG modem << OK
    2022-04-07T10:36:52.712Z DEBUG modem << #XNRFCLOUD: 0,0
    2022-04-07T10:36:52.714Z DEBUG modem << #XNRFCLOUD: 0,0
    2022-04-07T10:37:01.258Z DEBUG modem << %CESQ: 65,3,17,2
    2022-04-07T10:37:03.818Z DEBUG modem << %CESQ: 66,3,22,3
    2022-04-07T10:37:20.399Z DEBUG modem << %CESQ: 255,0,255,0

    This time I went into nRF Cloud and added LTE device on sec tag 321



Reply
  • Stas Jis said:

    AT#XNRFCLOUD?

    #XNRFCLOUD: 0,0,654321,"nrf-350916060695718"

    From your previous comment your showed that you have a certificate for nRF Cloud. Did you change in prj.conf the sec_tag to 321?
    CONFIG_NRF_CLOUD_SEC_TAG=321
    What happens if you change this to 654321 and retry? 


    Stas Jis said:
    After that, I try to add my user device to the nRF cloud using the user ID (not IMEI, used the device ID, the same one used when generating certificates) and any password as you said earlier:
    For you custom board you can choose a Device ID that fits your application along with a PIN/HWID of your choice.

    I've programmed the SLM application and tested generating the following certs

    Then using the certificate manager in LTE Link Monitor to provision to my nRF9160DK

    2022-04-07T09:52:58.347Z INFO Updating CA certificate...
    2022-04-07T09:52:58.348Z DEBUG modem >> AT%CMNG=0,321,0,"-----BEGIN CERTIFICATE-----
    2022-04-07T09:52:58.360Z DEBUG modem >> MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF
    ...
    2022-04-07T09:52:58.581Z DEBUG modem >> rqXRfboQnoZsG4q5WTP468SQvvG5
    2022-04-07T09:52:58.593Z DEBUG modem >> -----END CERTIFICATE-----"
    2022-04-07T09:52:59.989Z DEBUG modem << OK
    2022-04-07T09:52:59.990Z INFO Updating client certificate...
    2022-04-07T09:52:59.991Z DEBUG modem >> AT%CMNG=0,321,1,"-----BEGIN CERTIFICATE-----
    2022-04-07T09:53:00.003Z DEBUG modem >> MIICojCCAYoCCQCRSlfrvINUyjANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJO
    ...
    2022-04-07T09:53:00.177Z DEBUG modem >> 3M3LgJOd
    2022-04-07T09:53:00.188Z DEBUG modem >> -----END CERTIFICATE-----
    2022-04-07T09:53:00.202Z DEBUG modem >> -----BEGIN CERTIFICATE-----
    2022-04-07T09:53:00.214Z DEBUG modem >> MIIDszCCApugAwIBAgIJAIt6VMjGN2CzMA0GCSqGSIb3DQEBCwUAMHAxCzAJBgNV
    ...
    2022-04-07T09:53:00.450Z DEBUG modem >> jzV+sF0OhtHgMgnAkUUU05UCqi8gWuC+qtimwx80X+ETCq4jpGqj
    2022-04-07T09:53:00.462Z DEBUG modem >> -----END CERTIFICATE-----"
    2022-04-07T09:53:00.514Z DEBUG modem << OK
    2022-04-07T09:53:00.516Z INFO Updating private key...
    2022-04-07T09:53:00.518Z DEBUG modem >> AT%CMNG=0,321,2,"-----BEGIN EC PARAMETERS-----
    2022-04-07T09:53:00.532Z DEBUG modem >> BggqhkjOPQMBBw==
    2022-04-07T09:53:00.544Z DEBUG modem >> -----END EC PARAMETERS-----
    2022-04-07T09:53:00.555Z DEBUG modem >> -----BEGIN EC PRIVATE KEY-----
    2022-04-07T09:53:00.567Z DEBUG modem >> MHcCAQEEIAQgeXklbT8V93LOekZgK+zuKxTEiw4IFSz8Yg2pPG1BoAoGCCqGSM49
    2022-04-07T09:53:00.579Z DEBUG modem >> AwEHoUQDQgAEVZ8c8YzWCw/MSi85fJhVCv8h3eRFX7f4+WYoTutXX9MRyksPP6HA
    2022-04-07T09:53:00.704Z DEBUG modem >> C/RWEoj4NeNK5JM7uEq3eRdVMDh1eRLSuA==
    2022-04-07T09:53:00.725Z DEBUG modem >> -----END EC PRIVATE KEY-----"
    2022-04-07T09:53:00.825Z DEBUG modem << OK
    2022-04-07T09:53:00.826Z INFO Certificate update completed
    

    Then I run the following:

    2022-04-07T10:36:46.860Z DEBUG modem >> AT#XNRFCLOUD=1
    2022-04-07T10:36:46.865Z DEBUG modem << OK
    2022-04-07T10:36:52.712Z DEBUG modem << #XNRFCLOUD: 0,0
    2022-04-07T10:36:52.714Z DEBUG modem << #XNRFCLOUD: 0,0
    2022-04-07T10:37:01.258Z DEBUG modem << %CESQ: 65,3,17,2
    2022-04-07T10:37:03.818Z DEBUG modem << %CESQ: 66,3,22,3
    2022-04-07T10:37:20.399Z DEBUG modem << %CESQ: 255,0,255,0

    This time I went into nRF Cloud and added LTE device on sec tag 321



Children
No Data
Related