Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

CC3235SF: How to add LPDS to mqtt client demo app?

Part Number: CC3235SF
Other Parts Discussed in Thread: SYSCONFIG, TIDC-01005

Hi,

I got 3 questions about MQTT-client demo app.

1.  I would like to add power saving feature in mqtt client app.

I have added some codes to configure LPDS or LSI mode in main thread, and power_enablepolicy() to enable it. but the current still around 30mA.

Any idea how to add this? Like add sleep in correct function?

2.  the MQTT server is "#define MQTT_CONNECTION_ADDRESS         "mqtt.eclipse.org"",

seems sometimes it doesn't work? Do you have recommend one?

3. I am blocked on mqtt_client_app, line: 654 in mainThread.:

https://dev.ti.com/tirex/explore/node?node=AEAkFJWv37SxZrUC5sxJZw__fc2e6sr__LATEST

    // wait for CONNACK
    while(connected == 0); // <-- Block here, connected always be 0
    GPIO_enableInt(CONFIG_GPIO_BUTTON_0);
May I know whats going on?

Thanks a lot for this great forum and all of you guys support.

  • Hi Aichi,

    1. When the power policy is enabled and you are using a RTOS, the application MCU sleeps when the RTOS is idle and it sets its own wakeup timer to the next scheduled RTOS event (the MCU can also wake on networking activity from the NWP or a configured GPIO interrupt). In your application, that means that you want to use blocking APIs, semaphores/message queues, or sleep() whenever possible instead of empty while loops.
    2. "mqtt.eclipse.org" is a free public server for demo purposes, which may not be reliable. I like using "test.mosquitto.org" (also a free public server), and it also is suggested in the SimpleLink Academy MQTT lab

    In the mqtt_client example, the application is waiting for a connection to an Access Point before continuing. Have you set SSID_NAME and SECURITY_KEY in network_if.h? Do you see any error codes printed to the serial terminal?

    1. Keep in mind that many applications do not try to enter LPDS until after they are connected to a network, so a demo application may wait in an empty while loop for a connection, like in this case. If you are never successfully connecting to an Access Point, that is why the current consumption is so high.

    Best regards,

    Sarah

  • Hi Sarah,

    Sorry for my late.

    I had confirmed that wifi is connected and I am able to use publish/subscribe feature.

    I also added "Power_enablePolicy();" in mainthread but the 3235 seems still doesnt enter LPDS...

    Any suggestoin for how to let MQTT client demo app run into LPDS?

    BTW, when I enable "Power_enablePolicy()", seems the button is not working to publish...

  • Hi Aichi,

    If the application is waiting for a peripheral service (like a GPIO interrupt or hardware timer), the power policy will not enter LPDS. For more details on the power policy, see the TI Drivers Power Management documentation in the SDK.

    I believe in the mqtt_client example, the GPIO interrupt for the publish button is what is keeping the application from entering LPDS. You would have to change that to a power policy wakeup source instead.

    If you would like to measure a SDK example that is intended to demonstrate the low power policies, see the power_measurement example.

    Best regards,

    Sarah

  • Hi Sarah,

    The customer need MQTT with LPDS....so I cant use power measurement..

    I just remove push button handler and timer in main function and change the sysconfig as below:

    and add these to change to LSI in main thread:

        memset(&PmPolicyParams,0,sizeof(SlWlanPmPolicyParams_t));
        PmPolicyParams.MaxSleepTimeMs = 2000;

        sl_WlanPolicySet(SL_WLAN_POLICY_PM,
                     SL_WLAN_LONG_SLEEP_INTERVAL_POLICY,
                     (uint8_t *)&PmPolicyParams,
                     sizeof(PmPolicyParams));

        Power_enablePolicy();

    But now, the device is become running quite slow (almost freezeing)....but if disable LPDS, it will quite smooth..

    Any idea for this problem?

  • Hi Aichi,

    The mqtt_client example is not designed as a low-power demo. You cannot just remove the timer and button handlers. You need to decide how you want to replace the publish functionality. Additionally, you have unchecked "enable network wakeup LPDS," which means your application MCU will never wake to handle the incoming subscribed messages.

    There are TI designs available that use MQTT in low-power applications that you could reference, but they include much more functionality besides MQTT.

    Also, the network processor power policy (sl_WlanPolicySet) is separate from the application MCU power policy (Power_enablePolicy). You should determine if the NWP policy is appropriate for your use case. See the Power Policies section of the CC3x3x Power Management App Note.

    Best regards,

    Sarah

  • Hi Sarah,

    I know there are some MQTT base demo like TIDC-01005 e-lock design or AWS demo.

    I'll reference these.Let me know if you have more MQTT base sample codes.

    Thanks for your support.