[Thingy91] issues with https sample

Hello,

For my Thingy91 I want to do some simple HTTP POST. I had a look at the https client sample (nrf/samples/net/https_client) and thought It could be a good baseline for my project.

But In Visual Studio I saw I was in for a good time when Thingy91 was not among the compatible boards for the sample when adding a build configuration :). The 9160dk, 9161dk and 7002dk board is, but I added a config for the Thingy91 hoping it was just minor thing.

But when building I get the error: undefined reference to `tls_credential_add'. Adding a config for a compatible board and then build works just fine. I tried looking up documentation for that function, because I suspect I am missing some configuration, but had no luck.

Does anyone know why the Thingy91 does not work with the sample? 

  • After experimenting with the build configuration for Thingy91 and 9160dk in ChatGPT, I stumbled upon the necessity of adding CONFIG_MODEM_KEY_MGMT=y.

    Reflecting on the process, I wish I had been able to discern this independently. Despite my efforts to search for the problematic function, I found no mention of CONFIG_MODEM_KEY_MGMT in the Zephyr documentation (docs.zephyrproject.org/.../group__tls__credentials.html). This experience has highlighted the challenge of navigating Zephyr's extensive kconfig system, leaving me feeling somewhat overwhelmed.

    From what I gather, CONFIG_MODEM_KEY_MGMT appears to be specific to Nordic devices (developer.nordicsemi.com/.../CONFIG_MODEM_KEY_MGMT.html), facilitating key configuration for the nrf9160 modem. However, uncovering this information proved to be less straightforward than anticipated.

    I welcome any corrections or additional insights on this matter.

  • It seems I was not finished yet :)

    It builds fine but running the function modem_key_mgmt_exists returns -1. -1 Is either ENOBUFS or EACCES. Again I can't seem to find the definition. Im guessing EACCES as nrf9169 and thing91 should be much of the same in regards to buffer (?). What did I miss, I created the thingy91_nrf9160_ns build configuration.

  • Hi,

    If you just make a copy of nrf\samples\net\https_client\boards\nrf9160dk_nrf9160_ns.conf and rename it to thingy91_nrf9160_ns.conf, the sample should work, at least it does for me.

    Lars Fagerbakke said:

    Reflecting on the process, I wish I had been able to discern this independently. Despite my efforts to search for the problematic function, I found no mention of CONFIG_MODEM_KEY_MGMT in the Zephyr documentation (docs.zephyrproject.org/.../group__tls__credentials.html). This experience has highlighted the challenge of navigating Zephyr's extensive kconfig system, leaving me feeling somewhat overwhelmed.

    From what I gather, CONFIG_MODEM_KEY_MGMT appears to be specific to Nordic devices (developer.nordicsemi.com/.../CONFIG_MODEM_KEY_MGMT.html), facilitating key configuration for the nrf9160 modem. However, uncovering this information proved to be less straightforward than anticipated.

    On the nRF91 series the TLS stack is (usually) offloaded to the modem, which means that the modems also handles the credentials. Credential management therefore has to be done a bit differently from e.g. the nRF7000 series, where the TLS stack is on the application processor, and the TLS credentials must be loaded into memory of the application processor (which is what tls_credential_add does).

    Lars Fagerbakke said:
    It builds fine but running the function modem_key_mgmt_exists returns -1. -1 Is either ENOBUFS or EACCES. Again I can't seem to find the definition.

    The error codes are typically defined in errno.h (though not all functions return errno error codes). However, which errno.h file is used depends on which libc implementation you are using.

    However, Zephyr has made their libc-implementation's errno.h compatible with the one of Picolib and Newlib, so in most cases you can refer to https://github.com/nrfconnect/sdk-zephyr/blob/main/lib/libc/minimal/include/errno.h

    If copying the configurations for one of the 91DK didn't work, can you share the logs from your Thingy?

    Best regards,

    Didrik

  • I guess it was some configuration, because after copying the 9161dk configs as you suggested   it seems to work, now I get error 111 when connecting to the webhost but that is a different problem I have to investigate.

    Error 111 is ECONNREFUSED as I can figure out from the errno.h you posted. Thanks!

  • Hi,

    Sorry the post is a bit old but did you successfully made HTTPS requests without 111 error? 

    Error 111 should be an error regarding the SSL certificate provisioning.

Related