MQTT Connection Error -12

Hello, 

I am working on connecting a NRF9161 to a MQTT server (EMQX) but i am getting a connection error (-12), I was hoping someone could help me navigate this one. It looks like the error is connected to memory for the CA cert. 

Some context:

I have successfully connected to the Nordic MQTT development server (8883 and 1883) by following the steps in the the MQTT over LTE example. When I try to connect to the EMQX server over port 8883 I get this error. 

Below are some details about the config files. 

I've tried maxing out the NRF_MODEM_LIB_HEAP to 4096 but that did not resolve the error. 4096 is the internal limit. 

[00:00:23.223,907] <inf> Simkura_SB6_READER: New buffer
[00:00:23.271,453] <inf> Simkura_SB6_READER: TX buffer sent
[00:00:25.633,087] <err> Simkura_SB6_MAIN: Error in mqtt_connect: -12
[00:00:25.641,082] <inf> Simkura_SB6_MAIN: Reconnecting in 60 seconds...
[00:00:30.129,333] <inf> Simkura_SB6_NETWORK: RRC mode: Idle
[00:01:26.237,762] <inf> Simkura_SB6_NETWORK: RRC mode: Connected

# Memory
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_NRF_MODEM_LIB_HEAP_SIZE=4096
Is there anyway to override the heap limit for the modem? 
Thank you, 
Jack
Parents Reply
  • Hi,

     

    Did you follow the lesson 4, exercise 2?

    If you take the solution (see here https://github.com/NordicDeveloperAcademy/cell-fund/tree/master/v2.8.x-v2.7.0/l4/l4_e2_sol), then download the emqx certificate, convert it as per the lesson, it should create a header in src/certificate.h.

    Then you need to change prj.conf::CONFIG_MQTT_BROKER_HOSTNAME="broker.emqx.io"

     

    I followed these two steps and it ran as expected on my end:

    *** Booting nRF Connect SDK v2.8.0-a2386bfc8401 ***
    *** Using Zephyr OS v3.7.99-0bc3393fb112 ***
    [00:00:00.295,776] <inf> Lesson4_Exercise2: Initializing modem library
    [00:00:00.587,615] <inf> Lesson4_Exercise2: Comparing credentials: Match
    [00:00:00.587,646] <inf> Lesson4_Exercise2: Connecting to LTE network
    [00:00:04.252,380] <inf> Lesson4_Exercise2: RRC mode: Connected
    [00:00:05.233,703] <inf> Lesson4_Exercise2: Network registration status: Connected - home network
    [00:00:05.233,764] <inf> Lesson4_Exercise2: Connected to LTE network
    [00:00:05.467,071] <inf> Lesson4_Exercise2: IPv4 Address found 34.243.217.54
    [00:00:05.467,834] <inf> Lesson4_Exercise2: TLS enabled
    [00:00:06.937,255] <inf> Lesson4_Exercise2: MQTT client connected
    [00:00:06.937,316] <inf> Lesson4_Exercise2: Subscribing to: devacademy/subscribe/topic len 26
    [00:00:07.113,281] <inf> Lesson4_Exercise2: SUBACK packet id: 1234
    [00:00:13.869,964] <inf> Lesson4_Exercise2: RRC mode: Idle
    [00:00:29.376,647] <inf> Lesson4_Exercise2: Publishing: Hi from nRF91 Series device
    [00:00:29.376,678] <inf> Lesson4_Exercise2: to topic: devacademy/publish/topic len: 24
    [00:00:29.481,536] <inf> Lesson4_Exercise2: RRC mode: Connected
    [00:00:29.724,182] <inf> Lesson4_Exercise2: PUBACK packet id: 60412
    

     

    Kind regards,

    Håkon

Children
Related