This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP432E401Y: MQTT not connect after static IP set

Part Number: MSP432E401Y


Tool/software: Code Composer Studio

Hi,

By using original question . i have been able to set static IP of device. But my mqtt connection fail. its return error  -2006(SLNETERR_RET_CODE_INVALID_INPUT).

If i not use static IP means use default code(DHCP) then MQTT connection success.

so what is the problem?

Thanks,

Dinkar

  • Hello Dinkar,

    From your previous post, it looks like you are talking to Mosquito MQTT broker, which means that MSP432E4 will need internet connection.

    If you are using Static IP, how are you ensuring that MSP432E4 has access to internet? This might be your issue.

    Thanks,

    Sai

  • Hi sai,

    Thanks for reply.

    My previous post is related to MQTT SSL connection and this is different from that.

    In this post I have MQTT connection problem on 1883 post.

    First i take fresh code of mqttclientserver from SDK . take server address "test.mosquitto.org" and port "1883" and run the code my MSP432E4 connect to that server successfully.

    Now second test i update device ip from dynamic to static as your post "https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/681655". then run same code but mqtt connection fails with error  -2006.

    I ensure that MSP432E4 has internet connection from my DHCP based test code which connect to server successfully.

    In both case my hardware connections are same.

    Thanks,

    Dinkar

  • Hi Dinkar,

    You most likely did not set a static DNS server along with your static IP address. Use the following code to do so:

        uint32_t IPAddr = inet_addr("8.8.8.8");
    
        if (IPAddr) {
            CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,
                0, sizeof(IPAddr), (unsigned char *)&IPAddr, 0);
        }

    The above 8.8.8.8 server is Google's public DNS server, but you can point it to any server you want. 

    With that change, the mqttclient example in the latest 3.30 SDK works with a static IP.

    Let me know if that doesn't work for you.

    Regards,

    Michael

  • Hi Michael ,

    Thanks for reply.

    As per your suggestion , i add DNS server ip then  mqttclient example works with current sdk 3.20.

    Thanks ,

    Dinkar

**Attention** This is a public forum