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.

CC3135: MQTT throughput

Part Number: CC3135


Hi, 

I am using STM32L4 microcontroller and the BOOSTXL-CC3135 WIFI module interfaced through SPI, 

The  BOOSTXL-CC3135 WIFI module is connected with cables with an STM32L4 Nucleo board, and this, only in a prototype demonstration purpose. 

I have successfully ported the CC3135 driver that I found in the simplelink_sdk_wifi_plugin_2_40_00_22, and I used the DPL source files that I found under the simplelink_cc32xx_sdk_3_30_01_02\kernel\freertos\dpl SDK to interface the CC3135 module with FreeRTOS, 

I am also using MQTT network layer that I found under simplelink_cc32xx_sdk_3_30_01_02, and I ported the code example that I found under simplelink_sdk_wifi_plugin_2_40_00_22\examples\rtos\MSP_EXP432E401Y\demos\mqtt_client. 

I tested with the "test.mosquitto.org"  broker, and as a result, I have only 1Mbps as a throughput test result, 

Is there any way to increase my MQTT publish throughput ? Note that I am using my maximum SPI Prescaler (15 Mbps)

When reading the CC3135 Programmer's Guide, I found that I should change Socket Properties, as PHY Data Rate and TW Power just after the socket creation, 

so in the MQTTNet_commOpen function, and just after socket creation, I added theses functions : 

    int16_t Status;
    uint32_t rate = 1;
    Status = sl_SetSockOpt(socketFd, SLNETSOCK_LVL_PHY, SLNETSOCK_OPPHY_RATE, &rate, sizeof(rate));
    if (Status)
    {
      /* Error */
      __BSW_PRINTF(" Error ! \n"); 
    }
    uint32_t TxPower = 1; /* valid range is 1-15 */
    Status = sl_SetSockOpt(socketFd, SLNETSOCK_LVL_PHY, SLNETSOCK_OPPHY_TX_POWER, &TxPower, sizeof(TxPower));
    if (Status)
    {
      /* Error */
      __BSW_PRINTF(" Error ! \n");
    }

unfortunately, these functions always returns (-1) as a Status result. 

What did I miss to make these functions return wrong results ? 

Are theses functions let me have a better throughput ? 

Should I modify MQTT function ? or is there any function callBack that let me modify socket option without modifying MQTT library ? 

Regards, 

Ghada

  • Hello Ghada,

    I don't know exactly where your adding this code but it should be called after the socket is created in the createSocket function. Also, you are mixing slnet sock parameters with sl_sock functions. You should be using SlNetSock_setOpt. Refer to slnetsock.h for more details. We have a separate socket interface in TI drivers (this is where sl_SetSockOpt exist). If you do modify the mqtt library you need to rebuilt it to generate a new library file.  

    I'm not sure if changing the rate will get you higher throughput for MQTT but this is a quick test to find out. What quality of service are you using?

    Jesu

  • Hi 

    You are right, I should use SlNetSock_setOpt instead of sl_SetSockOpt, but this does not resolve my issue, the returned value of this function is always equal to -1. 

    I am calling this function in the MQTTNet_commOpen procedure, juste after the createSocket function calling. and I don't need to rebuilt and generate a new library file because, in my IAR project, I am using the .c/.h mqtt source file that I found under simplelink_sdk_wifi_plugin_2_40_00_22\source\ti\net\mqtt\platform. 

    Im using the MQTT_QOS1 as an mqtt quality of service, and this to be as closely as possible to my final application. 

    If neither the rate neither tx power let me get higher throughput for MQTT, what should I do to increase it ? 

    Thank you, 

    Ghada

  • Hi Ghada,

    It would be better to use QOS0 so you won't have the additional ACK latency.

    Jesu

  • Hi, 

    Unfortunately, I have to use the QOS1, due to my application needs. 

    What is the purpose of the rate if it does not change throughput for TCP?  and what is the meaning of SL_SOCK_TX_RATE_54M for example ? 

    I call SlNetSock_setOpt function in the MQTTNet_commOpen procedure, just after the createSocket function call. Why this function always returns -1 (SL_ERROR_BSD_SOC_ERROR) ?

    In another hand, I tested the SlNetSock_getOpt function to get the SLNETSOCK_OPPHY_RATE socket option, It returns a success value but the received rate is equal to 0, I didn't find its signification in the SlWlanRateIndex_e enumeration, it corresponds to witch rate?

    What is the expected throughput result that I should have using  mosquitto broker and QOS1 if I use the example code that I found under simplelink_sdk_wifi_plugin_2_40_00_22\examples\rtos\MSP_EXP432E401Y\demos\mqtt_client. 

    Note that in the CC3135 Device Overview page, it is indicated that the application throughput of the TCP is 13 Mbps, how can I reach this speed result ? 

    Regards, 

    Ghada 

  • Hi Ghada ,

    This APIs are related to transceiver mode not a connected mode like STA or AP mode. In this connected mode is best modulation and speed determined by CC3135 according own internal strategy. Also it depends on your infrastructure access point and RF environments.

    Jan

  • Hi Ghada,

    The datasheet numbers assume ideal case with bare TCP socket. MQTT runs on top of TCP and has additional overhead. Plus you are using QOS1 which requires ACKs on messages so it increases latency. Because of this, I do not think you will get datasheet numbers on effective throughput.

    When you connect to a router, our NWP will communicate with it in the fastest rate possible. This rate is selected upon connection and could change depending on error rate. Two things you could check is:

    1. make sure you're not getting high error rates in your environment which could cause the NWP to adjust the transmission rates
    2. make sure your SPI is running at 20MHz for the NWP
    3. make sure your router supports these data rates (likely does assuming you don't have really old router)

    Jesu