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

nRF9160: not retrieving DNS servers with IPV6

I am currently working on a project with a nRF9160 and in the very early stages of evaluation.

I have a few, hope not too many questions that I hope can be answered here, if it is not too much trouble.
I am starting fresh with the nRF9120SK, but do have prior experience with the nRF51 and nRF52 chips, though it was several years ago, the development environments were quite different, especially with the added Zephyr libraries.  Ultimately this project might be implemented as a serial_lte_modem using another MCU that handles the main logic of the device.

I have been searching on these forums and internet search engines today and yesterday quite a bit and have a few unresolved questions.

Using a macOS Big Sur development environment, I can go into specifics but it is not related to the current question.
I am currently using the example at
/opt/nordic/ncs/v1.4.1/nrf/applications/serial_lte_modem

Built with the command
west build -b nrf9160_pca10090ns

Is there a difference between these two commands?  Does it result in the same build?
west build -b nrf9160_pca10090ns
west build -b nrf9160dk_nrf9160ns

I am using the SDK version v1.4.1, modem software version 1.2.3 (I had some trouble updating it, it was in a very early 0.6.x.x-alpha state when I received the PCB).
Following this guide
https://devzone.nordicsemi.com/f/nordic-q-a/53208/updating-nrf9160-modem-firmware-through-the-command-line
I was able to bring it up to date after a few hours of frustration.

If anyone is interested in how I brought this up to date I can share the procedure, but I had to use the python nrfjprog wrapper to do it.

I have a nRF9160DK and am using a MVNO SIM operating in Japan with KDDI by au.

I am going to provide the output of some commands so you can see the results.

It appears that this SIM only supports IPV6, is there such a thing?

Here is the output of some of the network information.

+CGPADDR: 0,"0000:0000:0000:0000:0000:004A:XXXX:9801" (removed some information for privacy)
+CGCONTRDP: 0,,"ims","","",,,,,,,1500

I have another SIM here (I have to manually set the APN) that retrieves an IPV4 address and DNS servers with the following output.

I have the following output with that SIM card, I have to use AT+CGDCONT=0,"IP","iijmio.jp" to set the APN before enabling the modem.

If you would like to add this SIM card to the list of automatically configured APNs please let me know, I am more than happy to provide details.

+CGDCONT: 0,"IP","iijmio.jp","XXX.XXX.123.XXX",0,0 (removed some information for privacy)
+CGCONTRDP: 0,,"iijmio.jp","","","202.232.2.2","202.232.2.3",,,,,1500

I am using this guide at 

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.4.1/nrf/applications/serial_lte_modem/doc/slm_description.html

to test a connection to google.com.  I can connect fine with the second listed SIM card that retrieves an IPV4 address.

I can not connect with the first SIM that retrieves an IPV6 address, it has no DNS servers.

I found information that I can manually specify DNS servers, but I don't know how to do this with AT commands.

https://devzone.nordicsemi.com/f/nordic-q-a/50029/nrf9160-modem-firmware-v1-0-0-setting-custom-dns-server/235419#235419

  • Hm, I ran the two commands below and restarted, the nRF9160 is in a restart loop somehow, I will try to enable some more debug options to see if I can find out why...

    I only enabled CONFIG_BSD_LIBRARY_TRACE_ENABLED=y and then rebuilt, programmed.

    I as soon as I did the two commands...

    AT%XMODEMTRACE=1,2
    AT+CFUN=0

    I pressed the hardware reset key on the dev kit and now it just loops "Ready" about once a second, and I also checked the trace file, it is empty I think.

  • I am not sure what is going on with by build, it is not outputting a trace it seems, do you have a prebuilt hex file that I can upload to it?  Also please tell me which modem firmware I should run to match with it.  I was on 1.2.3, downgraded to 1.2.2 to see if that was the issue.  I have tried SDK 1.4.1 and 1.4.99 with the same results, here is the prj.conf file for the applications/serial_lte_modem application that I used to build with.  Any recommendations?  A different application perhaps? 

    If you can just provide me with a verified working hex file it should get things going also.  Please tell me which modem firmware version I should use with it.

    #
    # Copyright (c) 2020 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    # 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=n
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n

    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_NATIVE=n

    # BSD library
    CONFIG_BSD_LIBRARY=y
    # Align the max FD entry to BSD_MAX_SOCKET_COUNT(8)
    CONFIG_POSIX_MAX_FDS=8
    # Enable below for modem trace
    CONFIG_BSD_LIBRARY_TRACE_ENABLED=y

    # Use GPIO
    CONFIG_GPIO=y
    CONFIG_GPIO_NRFX=y
    CONFIG_GPIO_NRF_P0=y

    # UART interface
    CONFIG_SERIAL=y
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_TIMER2=y

    # LTE link control
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

    # Stacks and heaps
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192

    # AT_CMD
    # Enable AT_CMD debug for details
    CONFIG_AT_CMD_LOG_LEVEL_DBG=y

    # Device power management
    CONFIG_DEVICE_POWER_MANAGEMENT=y

    # Enable SUPL client support
    #CONFIG_SUPL_CLIENT_LIB=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
    CONFIG_FLASH=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y

    #
    # SLM-specific configurations
    #
    CONFIG_SLM_LOG_LEVEL_INF=y
    # Enable GPIO wakeup if sleep is expected
    #CONFIG_SLM_GPIO_WAKEUP=y
    # Use UART_0 (when working with PC terminal)
    CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
    # Use UART_2 (when working with external MCU)
    #CONFIG_SLM_CONNECT_UART_2=y
    #CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2

    # Use optional GPS service
    #CONFIG_SLM_GPS=y
    # Use optional FTP client service
    #CONFIG_SLM_FTPC=y
    # Use optional MQTT client service
    #CONFIG_SLM_MQTTC=y
    # Use optional HTTP client service
    CONFIG_SLM_HTTPC=y

  • Hi Didrik,

    Ah, it occurred to me that perhaps the UART is not connected that is outputting the modem trace.

    I was under the impression that there are three UARTs (uart0, uart1, uart2) on the nRF9160, but I only see UART1 and UART2 on the schematic for the nRF9160DK.  Which UART is the trace supposed to come out of?  I have not changed any jumpers or such on the board, but this is also an engineering sample version, perhaps there are some hardware differences?  I could not find detailed schematics for different board versions to compare.

    Also I was not specific about which hex file I am programming, I am programming the merged.hex file, but that has never given me problems with the below command.

    /usr/local/bin/nrfjprog -f NRF91 --program build/zephyr/merged.hex --sectorerase

  • Hi Didrik,

    Ok I think I have a valid trace, this is modem firmware v1.2.3.

    The problem I had is that the nRF Connect v3.6.1 - Trace Collector on MacOS does not connect to the correct serial device when "Auto device/port filter" is turned on.  I had to turn that off and manually connect to the third serial port.  Please let me know if this data is valid.

  • Thanks. This last trace was valid.

    It shows that the network doesn't provide a DNS address, which explains the failure when using the hostname.

    The modem trace also shows that the modem tries to find neighboring routers with ICMPv6 router solicitation messages, but doesn't get any replies.

    It also sends a TCP SYN packet to your server, but doesn't get any reply.

    The TCP SYN packet is sent over IPv4. The modem uses the address 0.0.0.0, which indicates that it hasn't been provided with any IPv4 address by the network. This is probably why the server isn't able to respond, if the packet arrives at all.

    Could you try to use the IPv6 address of the server, or use nrf_setdnsaddr() to set the DNS server manually?

    The best place to add the call to nrf_setdnsaddr() is probably in start_execute(), right after the call to handle_bsd_lib_init_ret() in main.c.


    I forgot to mention it in my last reply, but you should be able to upload files to devzone. You should find the option here:

Related