Nordic Academy Cellular IoT Fundamentals Lesson 4 Exercise 2 (l4_e2): MQTT Connect error -111 even in the solution build

We are running some internal training on cellular, and it seems that Lesson 4, Exercise 2 is missing something (in the tab for NCS v3.2.0); the instructions to provide the build system with the server certificate seem to be truncated (see image below):

missing part in section 4?

Even leaving aside the course content itself, it seems the solution (in l4_e2_sol) gets a -111 (connection refused) when trying to connect to the nordic academy MQTT broker:

*** Booting nRF Connect SDK v3.2.0-5dcc6bd39b0f ***
*** Using Zephyr OS v4.2.99-a57ad913cf4e ***
[00:00:00.281,555] <inf> Lesson4_Exercise2: Initializing modem library
[00:00:00.654,052] <inf> Lesson4_Exercise2: Connecting to LTE network
[00:00:01.723,175] <inf> Lesson4_Exercise2: RRC mode: Connected
[00:00:05.888,549] <inf> Lesson4_Exercise2: Network registration status: Connected - roaming
[00:00:05.888,641] <inf> Lesson4_Exercise2: Connected to LTE network
[00:00:06.908,905] <err> mqtt_helper: mqtt_connect, error: -111
[00:00:06.908,935] <err> Lesson4_Exercise2: Failed to connect to MQTT, error code: -111
[00:00:18.166,107] <inf> Lesson4_Exercise2: RRC mode: Idle

This seems to be specific to v3.2.0: the repo at https://github.com/NordicDeveloperAcademy/cell-fund has 3 commits (4808121, b525c06 and c2c1ce0), all with the same commit message that fundamentally altered the lesson, removing the crt_to_header python script and moving the exercise to the MQTT Helper library.

The exercise text also mentions including modem_key_mgmt.h, which was a necessary step in the old mqtt_connection.c file for v3.1.0, but has been removed since.

In short, it seems that updating l4_e2 to NCS v3.2.0 somehow went wrong and the course is now out of sync with the code.

  • Hi Simon,

    Thank you for the answer, I have marked it "Verified".


    As you say, injecting keys from flash onto the modem key store is not something that a production application should do, so I think there is an opportunity to improve the course rather than just fixing it: instead of having the course show the developer how to do key injection "the quick and dirty way" (i.e. the way they should not use in the real world), why not change the course to include the instructions from your answer above? They are easy to follow, they yield a functional result, and that result is one that could actually be used as the starting point for prod.
    If going through Quick Start to flash the AT Commands binary and back is a bit awkward, maybe the user could be instructed to enable the AT host library so that they can inject the certificate with the same firmware?

    In either case, thank you again, it's good to see that we didn't have a problem on our side.

Related