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.

  • , the nrf-<IMEI> device ID should only be used with Nordic HW. For you custom board you can choose a Device ID that fits your application along with a PIN/HWID of your choice. 

    Note that the default <sec_tag> for nRF Cloud credentials is 16842753, which you set when using LTE Link Monitor's Certificate Manager. More information on this under modem key management.

  • We need to have access to the nRF cloud in the device to work with AGPS, and we also work separately with an Amazon broker to unload / upload data.
    Since we installed certificates and keys to communicate with Amazon in our custom board, we cannot reach the nRF Cloud.
    Is there any way to check that we have not removed the certificates needed for nRF clouds (with the tag 16842753)?

    You also say that on custom devices (with nrf9160) not need use nrf-<IMEI> for cloud registration, but any attempts to register devices fail (Code 40412).

    Is there a sequence of actions required to add a user device to the nRF cloud?

    Now any attempt to connect to the cloud gives the result:

    AT#XNRFCLOUD=1
    OK

    #XNRFCLOUD: 0,0

    #XNRFCLOUD: 0,0

    AT#XNRFCLOUD?

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

    OK

  • Stas Jis said:
    You also say that on custom devices (with nrf9160) not need use nrf-<IMEI> for cloud registration, but any attempts to register devices fail (Code 40412).

    Yes, so when you have generated the certificates the device still needs to connect to nRF Cloud once. Usually this is done by running e.g. Asset Tracker v2, which will give you the prompt in the LTE Link Monitor that the device is ready to be provisioned. From here you should be able to add the device to nRF Cloud. 

    This can be more cumbersome adding one and one, so adding the device using Preconnect provisioning might be better. You can also add multiple devices using the Provisioning Devices in nRF Cloud where you can upload a .csv file that has information to multiple devices.

    As the JITP certification generator states: 

    Certificates are used to provision a device on nRF Cloud. There are two certificate types: non-JITP and JITP. Please read about these types and cloud-provisioning. If you are certain you want to use a JITP certificate, use the form below. In most cases, however, it is better to generate your own certificates and provision your devices using the Provision Devices endpoint, as explained in the guide.

  • Our nRF Cloud team has provided the following information:

    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.
    At this point the user should associate the device with their account, the UI on the cloud will spin and/or time out.
    Send another connect attempt from SLM: AT#XNRFCLOUD=1 and it should connect properly.
    Refresh the device page on nRF Cloud and they should see the device listed.
  • 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?

Related