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.

Mqtt on TM4C1294

Other Parts Discussed in Thread: CC3200

Hello,
 I want to get a mqtt client running on the TM4C1294-XL.

I tried mosquitto and using sockets below the mqtt-layer. I got this running on the CC3200. Therefore I used the simplelink sockets.

But on the TM4C, there is only the lwip and the uip implementation of the TCP/IP-Stack und no example using sockets. I worked with the enet_lwip example and added the mosquitto sources to the project. Then I tryed to configure the lwip to get sockets working, but its very difficult. I do not have the project in front of me, but I think the enet_lwip example does not use an rtos.Is it correct that I need to an os (FreeRTOS) to get sockets running?

So does anyone know hot to configure lwip to get socket-functions (connect, recv,...) running?

Should I do it like these people: #e2e.ti.com/.../1384385

Their setting is:

* NO_SYS to 0

* RTOS_FREERTOS to 1

in the lwipopts.h file.

According to this, post

"https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/379546/1347470"

the TI employee says, that there is also a tcp/ip stack in ti-rtos? is this correct? So it would be easier to use this on TM4C?

Is there a better way to get mqtt running on TM4C?

I found this solution using energie platform:

#developer.ibm.com/.../

But I would prefer to stay in CCS.

So thank you for all your answers,

MIchael

  • Hello Michael,

    The examples in TivaWare are with Raw lwIP calls and not with sockets. I would need to see how to get socket programming working in context of lwIP and I would have to say that it would take time to get socket programming example.

    The TI RTOS uses its own TCP/IP stack and it would be within CCS. It already has tcp echo example which can be used as a starter. Details on Socket Programming within TI RTOS would need to be checked on the TI RTOS page or forum.

    Regards
    Amit
  • Hello Amit,

    today I got the "senshub_iot" example compiling with mosquitto mqtt using sockets.

    From this post, e2e.ti.com/.../1565578 I have the information:

    lwIP provides this interface but it's only possible to use it if you are running an RTOS because it relies upon threads and semaphores.

    So I have to use an OS. But for the TM4C, there are nearly no examples with OSes, or am I wrong? The only I found was senshub_iot uisng FreeRTOS.

    I had to activate these switches:

    LWIP_NETCONN 1

    LWIP_PROVIDE_ERRNO 1

    LWIP_SOCKET 1

    LWIP_COMPAT_SOCKETS 1

    then I had a problem with wrong defined symbols: "raw_pcb has no field lwip_recv" and "tcp_pcb has no field lwip_accept". According to this post: lists.gnu.org/.../msg00076.html there is a problem, because all source files are included into a single one (??), here it is lwiplib.c in the senshub_iot example. I had to undef recv and accept in raw.c as a quick fix.

    After that I had some problems with the sequence of includes and finally I had to put the definition of the following functions as dummy in third_party\lwip-1.4.1\ports\tiva-tm4c129\sys_arch.c, because the symbols were not defined??

    int sys_sem_valid(sys_sem_t* s)

    {

    return -1;

    }

    void sys_sem_set_invalid(sys_sem_t* s)

    {

    int i = 0;

    }

    void sys_mbox_set_invalid(sys_mbox_t* s)

    {

    int i = 0;

    }

    So for me it seems, that using sockets with lwip is not very common, at least on the TM4C. But for using mosquitto, I need sockets, or am I wrong? Has anyone else ever had the problem with the undefined functions or other prblems with lwip sockets?

    Would there be a better way to implement mqtt on TM4C?

    Thanks in advance,

    Michael

  • Hello Michael

    I would suggest using TI RTOS. Please do check if the TI RTOS does have socket examples.

    Regards
    Amit