Issue while establishing connection with MQTT broker using nRF9151

Hi Team,

We are trying to establish connection between our nRF9151 board with NB-IoT enabled Jio Sim and MQTT broker using the sample provided in lesson-4-exercise-1. However we are observing the below mentioned error.

[00:01:26.084,655] <inf> Lesson4_Exercise1: RRC mode: Connected
[00:01:36.918,792] <inf> Lesson4_Exercise1: RRC mode: Idle
[00:01:47.971,313] <inf> Lesson4_Exercise1: RRC mode: Connected
[00:01:59.609,466] <inf> Lesson4_Exercise1: RRC mode: Idle
[00:02:16.859,161] <inf> Lesson4_Exercise1: RRC mode: Connected
[00:02:20.554,321] <inf> Lesson4_Exercise1: Network registration status: Connected - home network
[00:02:20.554,412] <inf> Lesson4_Exercise1: Connected to LTE network
[00:02:31.186,645] <inf> Lesson4_Exercise1: RRC mode: Idle
[00:02:32.619,628] <inf> Lesson4_Exercise1: RRC mode: Connected
[00:02:32.819,152] <inf> Lesson4_Exercise1: IPv4 Address found 20.82.16.164
[00:02:32.819,580] <inf> Lesson4_Exercise1: Connection to broker using mqtt_connect
[00:02:32.820,526] <err> Lesson4_Exercise1: Error in mqtt_connect: -114
[00:02:32.820,526] <inf> Lesson4_Exercise1: Reconnecting in 60 seconds...
[00:02:43.122,985] <inf> Lesson4_Exercise1: RRC mode: Idle
[00:03:32.820,587] <inf> Lesson4_Exercise1: Connection to broker using mqtt_connect
[00:03:32.827,514] <err> Lesson4_Exercise1: Error in mqtt_connect: -114
[00:03:32.827,514] <inf> Lesson4_Exercise1: Reconnecting in 60 seconds...
[00:04:32.827,606] <inf> Lesson4_Exercise1: Connection to broker using mqtt_connect
[00:04:32.834,625] <err> Lesson4_Exercise1: Error in mqtt_connect: -114
[00:04:32.834,625] <inf> Lesson4_Exercise1: Reconnecting in 60 seconds...
[00:05:32.834,686] <inf> Lesson4_Exercise1: Connection to broker using mqtt_connect
[00:05:32.841,705] <err> Lesson4_Exercise1: Error in mqtt_connect: -114
[00:05:32.841,705] <inf> Lesson4_Exercise1: Reconnecting in 60 seconds...

With this sim we have already tried ping command (ping -d google.com) using model_shell sample and it's working so we could confirm the data availability and internet connectivity. However, unable to achieve MQTT communication. 

SDK version : NCS 3.0.0 

Kindly let us know what's causing the problem and how can we resolve it.

Thanks,

Vivek

Parents Reply Children
  • Hi Øyvind,

    We could resolve the -114 issue with the shared config but now observing another errors while establishing the connection with the broker. We are using the base code from lesson-4-excercise-1 with some changes as mentioned below.

    Errors are as below:

    [00:00:00.289,367] <inf> Lesson4_Exercise1: Initializing modem library
    [00:00:00.557,281] <inf> Lesson4_Exercise1: Connecting to LTE network
    [00:01:38.373,413] <inf> Lesson4_Exercise1: RRC mode: Connected
    [00:01:44.323,822] <inf> Lesson4_Exercise1: Network registration status: Connected - home network
    [00:01:44.323,974] <inf> Lesson4_Exercise1: Connected to LTE network
    [00:01:44.324,615] <inf> Lesson4_Exercise1: IPv6 Address found custom_broker_ipv6_addr
    [00:01:44.325,805] <err> Lesson4_Exercise1: Error in mqtt_connect: -118
    [00:01:44.325,836] <inf> Lesson4_Exercise1: Reconnecting in 60 seconds...
    [00:02:14.527,160] <inf> Lesson4_Exercise1: RRC mode: Idle
    [00:02:44.332,916] <err> Lesson4_Exercise1: Error in mqtt_connect: -12
    [00:02:44.332,977] <inf> Lesson4_Exercise1: Reconnecting in 60 seconds...
    [00:03:44.340,057] <err> Lesson4_Exercise1: Error in mqtt_connect: -12
    [00:03:44.340,118] <inf> Lesson4_Exercise1: Reconnecting in 60 seconds...

    The changes made in sample are as below

    In prj.conf

    CONFIG_MQTT_BROKER_HOSTNAME="custom_broker_ipv6_addr"
    CONFIG_MQTT_PUB_TOPIC="/device_id/data"
    CONFIG_MQTT_BROKER_PORT=1883

    In mqtt_connection.c

    static struct mqtt_utf8 password = MQTT_UTF8_LITERAL("custom_password");
    static struct mqtt_utf8 user_name = MQTT_UTF8_LITERAL("custom_username");
    client->password = &password;
    client->user_name = &user_name;

    Can you please let us know why this is happening?

    Thanks,

    Vivek

  • So the devzone ticket tls-error-mqtt---error-in-mqtt_connect--111 helped us and we are able to solve the issue by moving struct mqtt_utf8 password, user_name; to global space.

    Thanks,

    Vivek

Related