HTTPS sample does not work on nRF9161DK

I'm trying to run the vanilla HTTPS sample on the nRF9161 DK: sdk-nrf/samples/net/https_client/README.rst at 4b9841a28e97e9d61b93f8981375d644b9d04ea0 · nrfconnect/sdk-nrf

The sample does not compile. In fact, I get a lot of the same issues as described in this thread:
(7) TLS on Thingy91 not working - Nordic Q&A - Nordic DevZone - Nordic DevZone

After tweaking the sample to add in some missing config (CONFIG_TLS_CREDENTIALS=y and CONFIG_MODEM_KEY_MGMT=y), it compiles, but gets an overflow exception:

Connecting to the network
+CGEV: EXCE STATUS 0
+CEREG: 2,"4128","03437E10",7
+CSCON: 1
+CGEV: ME PDN ACT 0,0
+CNEC_ESM: 50,0
+CEREG: 5,"4128","03437E10",7,,,"11100000","11100000"
+CEDRXP: 4,"1001","1001","0001"
%XTIME: "4A","4211810065224A","00"
[00:00:09.527,191] <err> os: ***** USAGE FAULT *****
[00:00:09.535,095] <err> os:   Stack overflow (context area not valid)
[00:00:09.544,616] <err> os: r0/a1:  0xaaaaaaaa  r1/a2:  0xaaaaaaaa  r2/a3:  0x0002b37e
[00:00:09.555,603] <err> os: r3/a4:  0x01000000 r12/ip:  0xaaaaaaaa r14/lr:  0xaaaaaaaa
[00:00:09.566,558] <err> os:  xpsr:  0xaaaaaa00
[00:00:09.574,066] <err> os: s[ 0]:  0xaaaaaaaa  s[ 1]:  0xaaaaaaaa  s[ 2]:  0xaaaaaaaa  s[ 3]:  0x00000001
[00:00:09.586,822] <err> os: s[ 4]:  0x00032e38  s[ 5]:  0x00032e38  s[ 6]:  0x0000004e  s[ 7]:  0x20020118
[00:00:09.599,578] <err> os: s[ 8]:  0x00000000  s[ 9]:  0x0002be1f  s[10]:  0x0000004e  s[11]:  0x0002af7b
[00:00:09.612,335] <err> os: s[12]:  0x0000004e  s[13]:  0x4e032e38  s[14]:  0x20020228  s[15]:  0x0002af9b
[00:00:09.625,030] <err> os: fpscr:  0x0002af83
[00:00:09.632,507] <err> os: Faulting instruction address (r15/pc): 0xaaaaaaaa
[00:00:09.642,700] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00:00:09.652,893] <err> os: Current thread: 0x2000ea38 (net_mgmt)
[00:00:09.662,017] <err> os: Halting system

I am on SDK v2.7 and firmware mfw_nrf91x1_2.0.1.

I have spent the last 16 hours trying to get a basic HTTPS request through. I tried the sample included in the nRF SDK to no avail, I've tried the various http_get, http_client, websocket, etc. samples in the Zephyr SDK, I've tried using socket offloading and also native network + mbedTLS, I've tried both the POSIX version of the APIs and the Zephyr versions, etc. -- I can't get any of them to succeed. A normal plaintext/HTTP connection works fine. However, I can't get any of the HTTPS samples in vanilla form to successfully run on the nRF9161 DK without hanging, crashing, or straight up failing to compile. I tried swapping them all over to my domain and my domain's CA certificate to no avail either. Can anyone point me to a working example of HTTPS?

Better yet, is there any higher-level API where I don't have to manually manage sockets, do DNS lookups (getaddrinfo), or manually set up TLS options just to make a basic REST API call? I had hoped that this stuff would've been abstracted out by the underlying libraries.

Parents
  • Hi,

    The log indicate a stack overflow in the net_mgmt thread.Can you try to incrase it by setting a higher value for CONFIG_NET_MGMT_EVENT_STACK_SIZE in your prj.conf? 

    Regarding exmaples, I recomend you migrade to nRF Connect SDK 2.8.0 which was released last week, where the HTTPS client sample builds fro the nRF9161 DK out of the box.

  • I've upgraded to v2.8.0 of the SDK, and trying to run the vanilla https_client sample from the nRF SDK. I get the same build errors as before.

    c:/ncs/toolchains/2d382dcd92/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(main.c.obj): in function `cert_provision':
    C:/repos/raos-hardware/https_client/src/main.c:108: undefined reference to `tls_credential_add'
    collect2.exe: error: ld returned 1 exit status

    If I add the missing config (CONFIG_TLS_CREDENTIALS=y), it compiles and runs, but completely hangs on the last message:

    *** Booting nRF Connect SDK v2.8.0-a2386bfc8401 ***
    *** Using Zephyr OS v3.7.99-0bc3393fb112 ***
    HTTPS client sample started
    Bringing network interface up
    Provisioning certificate
    Connecting to the network

    It has stayed connecting for 20 minutes now. Note that if I switch to plain HTTP, there are no issues. I just can't get any of the HTTPS samples to work.

Reply
  • I've upgraded to v2.8.0 of the SDK, and trying to run the vanilla https_client sample from the nRF SDK. I get the same build errors as before.

    c:/ncs/toolchains/2d382dcd92/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(main.c.obj): in function `cert_provision':
    C:/repos/raos-hardware/https_client/src/main.c:108: undefined reference to `tls_credential_add'
    collect2.exe: error: ld returned 1 exit status

    If I add the missing config (CONFIG_TLS_CREDENTIALS=y), it compiles and runs, but completely hangs on the last message:

    *** Booting nRF Connect SDK v2.8.0-a2386bfc8401 ***
    *** Using Zephyr OS v3.7.99-0bc3393fb112 ***
    HTTPS client sample started
    Bringing network interface up
    Provisioning certificate
    Connecting to the network

    It has stayed connecting for 20 minutes now. Note that if I switch to plain HTTP, there are no issues. I just can't get any of the HTTPS samples to work.

Children
Related