General Category > Discussion - MCU

Opportunities of implementing MQTT and their benefits

(1/2) > >>

Vladi:
Hello guys,

I'm using the MM900EV3A Board with the FT900 microcontroller and I want to implement a MQTT communication between the board and my host computer.
Bridgetk provides an example for implementing MQTT with the lwIP library using freeRTOS.

My question is: What are the bebefits of implementing MQTT together with an RTOS?

During my research for MQTT implementations I found another very common way to implementing MQTT without lwIP and freeRTOS: Using the eclipse paho library for C.
My first impression is that it seems to be easier to implement a mqtt client with paho rather than with lwIP/freeRTOS.
But what is the disadvantage of using a "normal" mqtt library?

I hope you guys can help me understanding this :)

BRT Community:
Hello,

Here's some feedback from the author of BRT_AN_041 FT90x-MQTT-Application:

You would still need networking support and some form of low level OS.

mbed and FreeRTOS are providing much the same support.

mbed has support for Ethernet and other stuff but you’d have to port it to FT900.

The advantage is that we have already implemented FreeRTOS, lwIP and mbedTLS in that example.

Maybe other users in the community have more input?

Best Regards,

BRT Community

Vladi:
Hey,

thanks for the answer.

First I thought it makes it more complex for me to develope my MQTT aplication because I don´t have any experience with RTOS.
But now I figured out that it shall be harder to develope applications when I just use the raw API of lwIP (Bare metal). The API with an RTOS shall be easier for application developement.
Is that correct?
Probably it would be hard to port your MQTT example to bare metral right? So I should just better study how an RTOS works.

One question: Which lwIP-API do you use for your lwIP examples? Is it the Netconn API or the BSD Socket API?

Best regards

Vladi

BRT Community:
Hello Vladi,


--- Quote ---One question: Which lwIP-API do you use for your lwIP examples? Is it the Netconn API or the BSD Socket API?
--- End quote ---

It doesn't use either of them. The MQTT app for lwIP does it.

Best Regards,
BRT Community

Vladi:
Dear BRT Community,

let's have a look on this callback fuction from the MQTT example:

static void client_mqtt_incoming_publish_cb(void *arg, const char *topic, u32_t tot_len)
{
   struct sub_info *subInfo = (struct sub_info *)arg;

   DEBUG_PRINTF("MQTT RECIEVE: %s (%u)\r\n", topic, (unsigned int)tot_len);

   memset(subInfo, 0, sizeof(struct sub_info));

   /* Decode topic string into a user defined reference */
   if(strcmp(topic, TOPIC_CONTROL) == 0)
   {
      subInfo->topic = TOPIC_CONTROL;
   }
   tfp_printf("%d\r\n", __LINE__);
}

I don't get what the intention of the first line of this function is.
When I'm debugging the code then there is a strange number in arg.
However, I tried to just struct sub_info *subInfo; but the result of this is that the microcontroller does a reset after the if condition.

That means this line has a purpose. But what is the purpose of this "arg"? Why does the micorocntroller a reset when not including "= (struct sub_info *)arg;"

I would really appreciate if someone could help me understanding this.

Navigation

[0] Message Index

[#] Next page

Go to full version