Why did the 9160 fail to resolve the domain name?

I developed a product on 9160 using the ncs1.9.0 SDK and the 1.3.2 modem firmware. When debugging, I found a problem. That is, when connecting to a domain name, the modem returned the error of domain name resolution failure. However, using the same hardware device, running the ncs1.2.0 SDK can connect to this address, that is, there is no problem with the network and the background domain name, Then why is there an error on ncs1.9.0? This is the modem trace I captured.

trace-2023-01-28T09-43-24.379Z.bin

This is my conf file and overlay file:

#
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
# General config
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_ASSERT=y
CONFIG_REBOOT=y
CONFIG_GPIO=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

# Log
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_LOG_MODE_OVERFLOW=y
CONFIG_LOG_BACKEND_RTT_MODE_DROP=y
CONFIG_LOG_BACKEND_SHOW_COLOR=n
CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP=n

# watch dog
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_TIMEOUT_MSEC=10000

# Modem info
CONFIG_MODEM_INFO=y

# Modem library
CONFIG_NRF_MODEM_LIB=y
CONFIG_NRF_MODEM_LIB_SYS_INIT=n
CONFIG_NRF_MODEM_LIB_TRACE_ENABLED=y

# BSD library
#CONFIG_BSD_LIBRARY=y
#CONFIG_BSD_LIBRARY_TRACE_ENABLED=n

# NVS
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_NVS=y
CONFIG_NVS_LOG_LEVEL_DBG=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# GPS
# Enable to use an external GNSS antenna
CONFIG_GNSS_SAMPLE_ANTENNA_EXTERNAL=y
# Enable to use nRF Cloud A-GPS
CONFIG_GNSS_SAMPLE_ASSISTANCE_NRF_CLOUD=n
# Secure User-Plane Location (SUPL) client library (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/others/supl_os_client.html)
CONFIG_GNSS_SAMPLE_ASSISTANCE_SUPL=y

# AT_CMD
#CONFIG_AT_HOST_LIBRARY=y
#CONFIG_UART_INTERRUPT_DRIVEN=y

# Console
CONFIG_CONSOLE_SUBSYS=n
CONFIG_CONSOLE_HANDLER=n
CONFIG_CONSOLE_GETCHAR=n
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
CONFIG_LTE_NETWORK_USE_FALLBACK=y
CONFIG_LTE_NETWORK_TIMEOUT=180
CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=n
CONFIG_LTE_NETWORK_MODE_NBIOT_GPS=y

# PSM
CONFIG_MODEM_AUTO_REQUEST_POWER_SAVING_FEATURES=y
# Set Periodic-TAU timer to 1 hour and Active-Time to 10 seconds.
CONFIG_LTE_PSM_REQ_RPTAU="01000110"
CONFIG_LTE_PSM_REQ_RAT="00000101"

# MQTT
CONFIG_MQTT_LIB=y
CONFIG_MQTT_LIB_TLS=n
CONFIG_MQTT_KEEPALIVE=300
CONFIG_MQTT_PUB_TOPIC="device/e2/pushdata"
CONFIG_MQTT_SUB_TOPIC="device/e2/"
CONFIG_MQTT_CLIENT_ID="my-client-id"
CONFIG_MQTT_USER_NAME="admin123"
CONFIG_MQTT_PASSWORD="admin123"
CONFIG_MQTT_DOMESTIC_BROKER_HOSTNAME="47.107.51.89"
CONFIG_MQTT_DOMESTIC_BROKER_PORT=1883
CONFIG_MQTT_FOREIGN_BROKER_HOSTNAME="18.135.53.53"
CONFIG_MQTT_FOREIGN_BROKER_PORT=1883
CONFIG_MQTT_MESSAGE_BUFFER_SIZE=512
CONFIG_MQTT_PAYLOAD_BUFFER_SIZE=512

# Library for buttons and LEDs
CONFIG_DK_LIBRARY=y
CONFIG_DK_LIBRARY_INVERT_LEDS=n

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_HW_STACK_PROTECTION=y

# SPI
CONFIG_SPI=y

# I2C
CONFIG_I2C=y

# UART
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# ANIMATION
CONFIG_ANIMATION_SUPPORT=y

# PPG
CONFIG_PPG_SUPPORT=n

# IMU
CONFIG_IMU_SUPPORT=n
CONFIG_STEP_SUPPORT=n
CONFIG_SLEEP_SUPPORT=n
CONFIG_FALL_DETECT_SUPPORT=n

# WIFI
CONFIG_WIFI_SUPPORT=n

# TP
CONFIG_TOUCH_SUPPORT=y

# AUDIO
CONFIG_AUDIO_SUPPORT=n

# Data Sync
CONFIG_SYNC_SUPPORT=y

# Temperature
CONFIG_TEMP_SUPPORT=n

# CRC Check
CONFIG_CRC_SUPPORT=y

# DEVICE POWER MANAGEMENT
CONFIG_PM_DEVICE=y

# Download client
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_MAX_HOSTNAME_SIZE=192
CONFIG_DOWNLOAD_CLIENT_MAX_FILENAME_SIZE=64
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096

# DATA UPDATE
CONFIG_DATA_DOWNLOAD_SUPPORT=y
CONFIG_DATA_DOWNLOAD_HOST_HK="aug-fm-files-hk.oss-cn-hongkong.aliyuncs.com"
CONFIG_DATA_DOWNLOAD_HOST_CN="aug-fm-files-cn.oss-cn-shenzhen.aliyuncs.com"
# IMG
CONFIG_IMG_DATA_UPDATE=y
CONFIG_IMG_DATA_DOWNLOAD_FILE="e2_img.bin"
# FONT
CONFIG_FONT_DATA_UPDATE=y
CONFIG_FONT_DATA_DOWNLOAD_FILE="e2_font.bin"
# PPG
CONFIG_PPG_DATA_UPDATE=y
CONFIG_PPG_DATA_DOWNLOAD_FILE="e2_ppg.bin"

# fota download
CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
CONFIG_FOTA_DOWNLOAD_HOST_HK="aug-fm-files-hk.oss-cn-hongkong.aliyuncs.com"
CONFIG_FOTA_DOWNLOAD_HOST_CN="aug-fm-files-cn.oss-cn-shenzhen.aliyuncs.com"
CONFIG_FOTA_DOWNLOAD_FILE="e2_update.bin"

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# DFU Target
CONFIG_DFU_TARGET=y

# Modem key management
CONFIG_MODEM_KEY_MGMT=y

# Application Upgrade support
CONFIG_BOOTLOADER_MCUBOOT=y

&spi2{
	compatible = "nordic,nrf-spim";
	status = "disabled";
	sck-pin = <3>;
	mosi-pin = <4>;
	miso-pin = <5>;
};

&spi3{
	compatible = "nordic,nrf-spim";
	status = "okay";
	sck-pin = <22>;
	mosi-pin = <20>;
	miso-pin = <5>;
};

&i2c1{
	compatible = "nordic,nrf-twim";
	status = "disabled";
	sda-pin = <30>;
	scl-pin = <31>;
	clock-frequency = <I2C_BITRATE_FAST>;
};

&i2c2{
	compatible = "nordic,nrf-twim";
	status = "disabled";
};

&uart0 {
	status = "disabled";
	current-speed = <115200>;
	tx-pin = <12>;
	rx-pin = <11>;
	/* delete rts-pin&cts-pin to release the related 2 pins for other uses */
	/delete-property/ rts-pin;
	/delete-property/ cts-pin;	
};

&uart1{
	status = "okay";
	current-speed = <115200>;
	tx-pin = <12>;
	rx-pin = <11>;
	/* delete rts-pin&cts-pin to release the related 2 pins for other uses */
	/delete-property/ rts-pin;
	/delete-property/ cts-pin;	
};

&uart2{
	status = "okay";
	current-speed = <115200>;
	tx-pin = <18>;
	rx-pin = <19>;
	/* delete rts-pin&cts-pin to release the related 2 pins for other uses */
	/delete-property/ rts-pin;
	/delete-property/ cts-pin;
};

  • Hi Biao,

    I checked your original case devzone.nordicsemi.com/.../297401

    hostname "aug-fm-files-cn.oss-cn-shenzhen.aliyuncs. com" has a space before com, is this the cause?

    Best regards,

    Charlie

  • Hi Charlie,

    Thank you for your reply. It may be that I made a mistake in the case, but there is no space in fact. It is defined in the prl.conf file, and I use ncs1.2.0 to run on the same terminal, and it can be parsed and connected. That is to say, there is no problem with the domain name itself and the terminal. I suspect that the configuration of ncs1.2.0 and ncs1.9.0 is different in some places, resulting in that it cannot be resolved to the address.

    This is part of the log information obtained by my terminal:

    00> [06096784] <inf> E2: [10:07:42:058]..NBRedrawSignal>>+CEREG: 5,1,"1D29","0AC2CD3D",9,,,"00000100","11100000"
    00> OK
    00> 
    00> 
    00> [06096806] <inf> E2: [10:07:42:059]..NBRedrawSignal>>reg_status:1
    00> 
    00> [06097053] <inf> E2: [10:07:42:067]..NBRedrawSignal>>+CSCON: 1,0
    00> OK
    00> 
    00> 
    00> [06097070] <inf> E2: [10:07:42:067]..NBRedrawSignal>>mode:0
    00> 
    00> [06097086] <inf> E2: [10:07:42:068]..NBRedrawSignal>>reg stat:1
    00> 
    00> [06130985] <wrn> download_client: Failed to resolve hostname aug-fm-files-cn.oss-cn-shenzhen.aliyuncs.com on IPv4
    00> [06137101] <inf> E2: [10:07:43:289]..modem_rsrp_handler>>rsrp_value:59
    00> 
    00> [06147635] <inf> E2: [10:07:43:610]..NBRedrawSignal>>+CEREG: 5,1,"1D29","0AC2CD3D",9,,,"11100000","11100000"
    00> OK

  • Hi Biao,

    Ok, it is interesting. There are some changes on these two versions regarding domain name resolution.

    sdk-nrf/download_client.c at v1.2.0 · nrfconnect/sdk-nrf (github.com)

    sdk-nrf/download_client.c at v1.9.0 · nrfconnect/sdk-nrf (github.com)

    I am not sure if it is related to the pan_id introduced. Can you modify the following part of the download client library in NCS 1.9.0 to verify?

    Please try to replace the following codes with just "err = getaddrinfo(hostname, NULL, &hints, &ai);" or add debug output to see which getaddrinfo is used?

    	if (pdn_id) {
    		hints.ai_flags = AI_PDNSERV;
    		(void)snprintf(pdnserv, sizeof(pdnserv), "%d", pdn_id);
    		err = getaddrinfo(hostname, pdnserv, &hints, &ai);
    	} else {
    		err = getaddrinfo(hostname, NULL, &hints, &ai);
    	}
    

    I also checked your previous modem trace recording, but I did not find the DNS part. I may need a new one later, but let's do the experiment first.

    Best regards,

    Charlie

  • HI Charlie

    I used single-step debugging and found that it called the following getaddrinfo function, resulting in domain name resolution failure. This is the screenshot; I also used ncs1.2.0 to debug. It called this function, but it used different parameters, and it can successfully resolve the domain name. This is the relevant screenshot.

    thsi is ncs1.9.0:

    thsi is Ncs1.2.0:

    I forgot to tell you that not all ncs1.9.0 terminals can't resolve this domain name. I have an ncs1.9.0 terminal that can resolve this domain name, but other terminals can't. But if those terminals burn the firmware of ncs1.2.0, they can resolve this domain name. What's more strange is that at present, my colleagues in the UK use the same batch of terminals. They have not encountered this problem. The only difference is that their terminals use the network of Lte-m, while I now use the network of NB.

  • Hi Biao,

    Ok, I suspect this might be a compatibility issue.

    1) There are two revisions of nRF9160 on the market. SiP revisions and variants, you can find their build code from the surface of nRF9160 SiP.

    2) According to MFW release note, Reversion 1 should use up to MFW1.2.8 for production. Reversion 2 should use upto MFW1.3.4.

    Before applying this version:

    • Note that this modem firmware is targeted nRF9160 SiP Revision 2 
    • It can be used for nRF9160 SiP Revision 1, but only for testing and development
    • It cannot be used for engineering samples of Revision 1 (e.g. DKs or Thingy:91 with version older than v0.9.0
    • After you upgrade to MFW 1.3.x it is not recommended to downgrade to MFW 1.2.x or MFW 1.1.x.(potential file system issues)

    Read out your revision by either AT command: AT%HWVERSION or look on the nRF9160 SIP for marking "B1".

    "B1" = Revision 2

    "B0" = Revision 1 

    The AT command responses for Revision 1 and Revision 2 SiPs will be "nRF9160 SICA B0A" and "nRF9160 SICA B1A" respectively.

    Early engineering Revision 2 (B1A) SiPs and Revision 1 (B0A) SiPs might produce AT command responses such as  "nRF9160 SICA BQA" and "nRFFFFFFFFF SICA FFFFFFFF" respectively.

    3) Adding Modem Firmware Compatibility Matrix, the suggest last development options are MFW1.2.8+NCS1.5.2 for reversion 1 and MFW1.3.4+NCS2.2.0 for reversion 2. Your test should be based on NCS1.2.0+MFW1.1.0 or NCS1.9.0+MFW1.3.2. for a correct SiP reversion.

    4) NB-IoT has a slower data rate compared with LTE-M, so it will take a longer time for the same amount of packages. If the network connection is not stable, for example, your device is far away from the cell station, the connection could break. I would suggest you verify the SiP chip revision and make a recording again if the problem still happens with this device.

    5) MFW1.3.4+NCS2.2.0+nRF9160 SiP Revision 2 is suggested for new product development. The stability and performance may have improved, and it is also cloud be a certification requirement for your device from your local operator. Mobile network operator certifications

    Best regards,

    Charlie

Related