I am running a FreeRTOS MQTT client on Microchip PIC32MZ eval board and able to connect to AWS MQTT server over wired Ethernet.
But When I try to connect to a MQTT Mosquitto broker running on my Windows, I get a connection error as follows:
C:\Program Files\mosquitto>mosquitto -v
1570213770: mosquitto version 1.6.7 starting
1570213770: Using default config.
1570213770: Opening ipv6 listen socket on port 1883.
1570213770: Opening ipv4 listen socket on port 1883.
1570213804: New connection from 192.168.9.169 on port 1883.
1570213804: Client disconnected due to protocol error.
The fact that the broker is getting a connection request from my PIC32MZ eval board, the IP and port # are correctly set up.
Does anyone have experience with trying to connect FreeRTOS MQTT client to a broker other than default AWS MQTT broker?
Thanks Richard for getting back.
Yes the Windows version of FreeRTOS MQTT client works fine with my local mosquitto.
But FreeRTOS MQTT client running on my PIC32MZ fails to connect to the same local mosquitto.
As I mentioned, FreeRTOS MQTT client running on my PIC32MZ works fine with AWS MQTT broker.
In theory, the following is all I have to change?
//static const char clientcredentialMQTT_BROKER_ENDPOINT[] = “atmaz5u2t2hej-ats.iot.us-east-2.amazonaws.com”;
static const char clientcredentialMQTT_BROKER_ENDPOINT[] = “192.168.9.70”;
From those logs, it looks like the demo application is still trying to perform a TLS handshake. If your broker is an unsecured Mosquitto server, this will cause the connection to fail.
To successfully connect to Mosquitto, you will need to change 2 lines of code in your demo. Assuming you are running this file as your demo:
Disable TLS by not passing any credentials.
networkInfo.u.setup.pNetworkCredentialInfo = NULL; // Line 411