NRF9160 https_client does not connect to example.com

1. am currently using the nrf9161_dk. and have not modified the modem FW in anyway. 

2. I am using the vscode extension provided by nordic to build/run this sample

        a, i am using version v2.4.1 for the SDK

3. this is my build config.  with this configuration  get the err 111 which when i look it up means   #define ECONNREFUSED 111   /* Connection refused */

this is the output:

*** Booting Zephyr OS build v3.3.99-ncs1-2 ***
HTTPS client sample started
Certificate mismatch
Provisioning certificate
Waiting for network.. PDP context 0 activated
OK
Looking up example.com
Resolved 93.184.216.34 (AF_INET)
Connecting to example.com:443
connect() failed, err: 111
PDP context 0 network detached

So then i tried adding mbed tools as well: 

build config with mbed tool: 

and i get this errno 22 #define  EINVAL 22   /* Invalid argument */ 

So then i has a thingy91 and decided to test that dev kit out, i uploaded that modem with mfw_nrf9160_1.3.5.zip  and i am running the exact same configurations and i am getting the same errors. 
does anyone have any ideas of what might be happening here and why the sample is not working, any input is appreciated. 
thanks, 
Parents
  • Hi,

    Could you please test the same sample in NCS v2.6.0? Do you get the same errors?

    Best regards,
    Dejan

  • Dejans, did you check, if that works with NCS v2.6.0?

  • I checked it with a nRF9160-DK and a nRF9161-DK, NCS-2.6.0:

    Works with both.

    Build log (nRF9161):

    Loading Zephyr default modules (Zephyr base).
    -- Application: .../nrf/samples/net/https_client
    -- CMake version: 3.29.2
    -- Found Python3: /usr/bin/python3 (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: .../.cache/zephyr
    -- Zephyr version: 3.5.99 (.../zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf9161dk_nrf9161_ns, Revision: 0.9.0
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.16.5 (.../zephyr-sdk-0.16.5-1)
    -- Found toolchain: zephyr 0.16.5 (.../zephyr-sdk-0.16.5-1)
    -- Found Dtc: .../zephyr-sdk-0.16.5-1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
    -- Found BOARD.dts: .../zephyr/boards/arm/nrf9161dk_nrf9161/nrf9161dk_nrf9161_ns.dts
    -- Generated zephyr.dts: .../nrf/samples/net/https_client/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: .../nrf/samples/net/https_client/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: .../nrf/samples/net/https_client/build/zephyr/dts.cmake

    warning: Experimental symbol NET_CONNECTION_MANAGER is enabled.

    Parsing .../nrf/samples/net/https_client/Kconfig
    Loaded configuration '.../zephyr/boards/arm/nrf9161dk_nrf9161/nrf9161dk_nrf9161_ns_defconfig'
    Merged configuration '.../nrf/samples/net/https_client/prj.conf'
    Merged configuration '.../nrf/samples/net/https_client/boards/nrf9161dk_nrf9161_ns.conf'
    Configuration saved to '.../nrf/samples/net/https_client/build/zephyr/.config'
    Kconfig header saved to '.../nrf/samples/net/https_client/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: .../zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: .../zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Using ccache: /usr/bin/ccache
    Dropping partition 'nrf_modem_lib_trace' since its size is 0.
    Dropping partition 'nonsecure_storage' since it is empty.
    -- Configuring done (4.9s)
    -- Generating done (0.1s)
    -- Build files have been written to: .../nrf/samples/net/https_client/build
    -- west build: building application
    [1/295] Preparing syscall dependency handling

    [3/295] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (.../zephyr), build: v3.5.99-ncs1
    [10/295] Generating ../../tfm/CMakeCache.txt
    CMake Warning at cmake/version.cmake:22 (message):
      Actual TF-M version is not available from Git repository.  Settled to
      v2.0.0
    Call Stack (most recent call first):
      CMakeLists.txt:22 (include)


    -- Found Git: /usr/bin/git (found version "2.34.1")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: .../zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Found Python3: /usr/bin/python3 (found version "3.10.12") found components: Interpreter
    CMake Deprecation Warning at .../zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
      'PYTHON_PREFER' variable is deprecated.  Please use Python3_EXECUTABLE
      instead.
    Call Stack (most recent call first):
      .../zephyr/cmake/modules/python.cmake:16 (find_package)
      .../zephyr/cmake/modules/user_cache.cmake:30 (include)
      .../zephyr/cmake/modules/extensions.cmake:5 (include)
      .../nrf/subsys/nrf_security/tfm/CMakeLists.txt:38 (include)


    -- Found Python3: /usr/bin/python3 (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: .../.cache/zephyr
    -- Configuring done (0.9s)
    -- Generating done (0.0s)
    CMake Warning:
      Manually-specified variables were not used by the project:

        CRYPTO_RNG_MODULE_ENABLED
        MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE
        PYTHON_PREFER


    -- Build files have been written to: .../nrf/samples/net/https_client/build/tfm
    [15/295] Performing build step for 'tfm'
    [164/168] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       32096 B        32 KB     97.95%
                 RAM:       10416 B        32 KB     31.79%
    [168/168] Linking C static library secure_fw/libtfm_s_veneers.a
    [17/295] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [293/295] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      115948 B       992 KB     11.41%
                 RAM:       45644 B     211608 B     21.57%
            IDT_LIST:          0 GB        32 KB      0.00%
    [295/295] Generating zephyr/merged.hex

    Console output:

    *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    HTTPS client sample started

    Bringing network interface up
    Provisioning certificate
    Provisioning certificate
    Connecting to the network
    +CEREG: 2,"67B9","01CC2B03",7

    +CSCON: 1

    +CGEV: ME PDN ACT 0,0

    +CNEC_ESM: 50,0

    +CEREG: 5,"67B9","01CC2B03",7,,,"11100000","11100000"

    Network connectivity established and IP address assigned
    Looking up example.com
    Resolved 93.184.215.14 (AF_INET)
    Connecting to example.com:443
    Sent 61 bytes
    Received 371 bytes

    >     HTTP/1.1 200 OK


    Finished, closing socket.
    +CEREG: 0

    +CGEV: ME DETACH

    +CSCON: 0

    Network connectivity lost
    Disconnected from the network

Reply
  • I checked it with a nRF9160-DK and a nRF9161-DK, NCS-2.6.0:

    Works with both.

    Build log (nRF9161):

    Loading Zephyr default modules (Zephyr base).
    -- Application: .../nrf/samples/net/https_client
    -- CMake version: 3.29.2
    -- Found Python3: /usr/bin/python3 (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: .../.cache/zephyr
    -- Zephyr version: 3.5.99 (.../zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf9161dk_nrf9161_ns, Revision: 0.9.0
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.16.5 (.../zephyr-sdk-0.16.5-1)
    -- Found toolchain: zephyr 0.16.5 (.../zephyr-sdk-0.16.5-1)
    -- Found Dtc: .../zephyr-sdk-0.16.5-1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
    -- Found BOARD.dts: .../zephyr/boards/arm/nrf9161dk_nrf9161/nrf9161dk_nrf9161_ns.dts
    -- Generated zephyr.dts: .../nrf/samples/net/https_client/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: .../nrf/samples/net/https_client/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: .../nrf/samples/net/https_client/build/zephyr/dts.cmake

    warning: Experimental symbol NET_CONNECTION_MANAGER is enabled.

    Parsing .../nrf/samples/net/https_client/Kconfig
    Loaded configuration '.../zephyr/boards/arm/nrf9161dk_nrf9161/nrf9161dk_nrf9161_ns_defconfig'
    Merged configuration '.../nrf/samples/net/https_client/prj.conf'
    Merged configuration '.../nrf/samples/net/https_client/boards/nrf9161dk_nrf9161_ns.conf'
    Configuration saved to '.../nrf/samples/net/https_client/build/zephyr/.config'
    Kconfig header saved to '.../nrf/samples/net/https_client/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: .../zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: .../zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Using ccache: /usr/bin/ccache
    Dropping partition 'nrf_modem_lib_trace' since its size is 0.
    Dropping partition 'nonsecure_storage' since it is empty.
    -- Configuring done (4.9s)
    -- Generating done (0.1s)
    -- Build files have been written to: .../nrf/samples/net/https_client/build
    -- west build: building application
    [1/295] Preparing syscall dependency handling

    [3/295] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (.../zephyr), build: v3.5.99-ncs1
    [10/295] Generating ../../tfm/CMakeCache.txt
    CMake Warning at cmake/version.cmake:22 (message):
      Actual TF-M version is not available from Git repository.  Settled to
      v2.0.0
    Call Stack (most recent call first):
      CMakeLists.txt:22 (include)


    -- Found Git: /usr/bin/git (found version "2.34.1")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: .../zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Found Python3: /usr/bin/python3 (found version "3.10.12") found components: Interpreter
    CMake Deprecation Warning at .../zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
      'PYTHON_PREFER' variable is deprecated.  Please use Python3_EXECUTABLE
      instead.
    Call Stack (most recent call first):
      .../zephyr/cmake/modules/python.cmake:16 (find_package)
      .../zephyr/cmake/modules/user_cache.cmake:30 (include)
      .../zephyr/cmake/modules/extensions.cmake:5 (include)
      .../nrf/subsys/nrf_security/tfm/CMakeLists.txt:38 (include)


    -- Found Python3: /usr/bin/python3 (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: .../.cache/zephyr
    -- Configuring done (0.9s)
    -- Generating done (0.0s)
    CMake Warning:
      Manually-specified variables were not used by the project:

        CRYPTO_RNG_MODULE_ENABLED
        MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE
        PYTHON_PREFER


    -- Build files have been written to: .../nrf/samples/net/https_client/build/tfm
    [15/295] Performing build step for 'tfm'
    [164/168] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       32096 B        32 KB     97.95%
                 RAM:       10416 B        32 KB     31.79%
    [168/168] Linking C static library secure_fw/libtfm_s_veneers.a
    [17/295] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [293/295] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      115948 B       992 KB     11.41%
                 RAM:       45644 B     211608 B     21.57%
            IDT_LIST:          0 GB        32 KB      0.00%
    [295/295] Generating zephyr/merged.hex

    Console output:

    *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    HTTPS client sample started

    Bringing network interface up
    Provisioning certificate
    Provisioning certificate
    Connecting to the network
    +CEREG: 2,"67B9","01CC2B03",7

    +CSCON: 1

    +CGEV: ME PDN ACT 0,0

    +CNEC_ESM: 50,0

    +CEREG: 5,"67B9","01CC2B03",7,,,"11100000","11100000"

    Network connectivity established and IP address assigned
    Looking up example.com
    Resolved 93.184.215.14 (AF_INET)
    Connecting to example.com:443
    Sent 61 bytes
    Received 371 bytes

    >     HTTP/1.1 200 OK


    Finished, closing socket.
    +CEREG: 0

    +CGEV: ME DETACH

    +CSCON: 0

    Network connectivity lost
    Disconnected from the network

Children
Related