MQTT simple not working with custom SSL/TLS configuration MQTT broker

Hi all,

First I tried the MQTT broker connection with MQTT sample for V2.3.0 which was successful but he sample from 2.3.0 is too complicated if I want to merge 2 other programs with it and they should run simultaneously so I decided to switch to MQTT from v2.2.0. I made changes to the broker name, port, added username and password in this way: 

    static struct mqtt_utf8 password;
    static struct mqtt_utf8 user_name;
	password.utf8 = (uint8_t*)CONFIG_MQTT_HELPER_PASSWORD;
	password.size = strlen(CONFIG_MQTT_HELPER_PASSWORD);
	user_name.utf8 = (uint8_t*)CONFIG_MQTT_HELPER_USERNAME;
	user_name.size = strlen(CONFIG_MQTT_HELPER_USERNAME);
	client->broker = &broker;
	client->evt_cb = mqtt_evt_handler;
	client->client_id.utf8 = client_id_get();
	client->client_id.size = strlen(client->client_id.utf8);
	client->password = &password;
	client->user_name = &user_name;
	client->protocol_version = MQTT_VERSION_3_1_1;
 and also changed the CA certificate but it is failing with the following error: 

[00:00:00.640,686] <inf> board_control: External SIM is selected
[00:00:00.640,747] <inf> board_control: Charger is set to auto
[00:00:00.644,744] <inf> mqtt_simple: The MQTT simple sample started
[00:00:00.644,744] <inf> mqtt_simple: Disabling PSM and eDRX
[00:00:00.651,672] <inf> mqtt_simple: LTE Link Connecting...
[00:00:03.899,627] <inf> mqtt_simple: LTE Link Connected!
[00:00:04.046,966] <inf> mqtt_simple: IPv4 Address found xx.xxx.xx.xx
[00:00:04.047,485] <dbg> mqtt_simple: client_id_get: client_id = nrf-B8DD48FEAB9AD548
[00:00:05.011,260] <err> mqtt_simple: MQTT connect failed: 5
[00:00:05.011,810] <inf> mqtt_simple: MQTT client disconnected: -111
[00:00:05.011,810] <err> mqtt_simple: mqtt_input: -111
[00:00:05.011,840] <inf> mqtt_simple: Disconnecting MQTT client...
[00:00:05.011,871] <err> mqtt_simple: Could not disconnect MQTT client: -128
[00:00:05.011,871] <inf> mqtt_simple: Reconnecting in 60 seconds...
uart:~$ 
 

I don't know what I missed, I made the same changes except adding the client.crt and client.key as there was no option to add this was well in the mqtt simple sample as I made for the sample from v2.3.0 that is working but this is not.

P.S: The IP address that is being printed is diff from the actual IP address of the server, can this be the issue?

My broker requires CA, Client.crt and client.key, In MQTT sample for V2.3.0, there was option to add all 3 of these but in MQTT from v2.2.0 there was only option to CA certificate but not the client.crt and client.key, how can I add these as well in MQTT from v2.2.0?

Device : actinius icarus

SDK : V2.2.0

Related