1 (edited by smitthhyy 2018-01-12 20:37:36)

Topic: WolfMQTT with MPLab Harmony - How to guide?

Does anyone know of a guide or how to on using WolfMQTT within Harmony that steps through how to use it.  There is an example in the wolfmqtt examples folder but that's a very generic one that works on Windows within visual studio and has no references to harmony except for a couple of compiler if's.

I follow the lab1 guide in Introduction to the MPLAB® Harmony TCP/IP Stack which gets the TCP/IP stack running and connected and able to ping the PIC32MZ EF Starter Kit. (I'm using PIC32MZ20148EFM144 which is the only thing I need to change from the lab guide).  MPLAB X IDE v4.05 on Windows with XC32(v1.42) and Harmony 2.0.5. The MHC is from the harmony 2.0.5 folder.

I use MHC to add wolfMQTT (in the Third Party Libraries section) and without doing anything else, it does compile.  WolfMQTT version included with Harmony 2.0.5 is version 0.10 (version.h - #define LIBWOLFMQTT_VERSION_STRING "0.10"). EDIT: Change to use v0.14.0 has same result.

As soon as I add #include "wolfmqtt/mqtt_client.h" to app.h I get a plethora of errors where the compiler can't find things, for example (just a few):

"C:\Program Files (x86)\Microchip\xc32\v1.44\bin\xc32-gcc.exe" -g -x c -c -mprocessor=32MZ2048EFM144 -ffunction-sections -O1 -DHAVE_CONFIG_H -I../src -I../src/system_config/pic32mz_ef_m_sk -I../src/pic32mz_ef_m_sk -I../../../../framework -I../src/system_config/pic32mz_ef_m_sk/framework -I../src/system_config/pic32mz_ef_m_sk/bsp -I../../../../third_party/tcpip/wolfmqtt -MMD -MF build/pic32mz_ef_m_sk/production/_ext/1029000301/mqtt_packet.o.d -o build/pic32mz_ef_m_sk/production/_ext/1029000301/mqtt_packet.o ../../../../third_party/tcpip/wolfmqtt/src/mqtt_packet.c -DXPRJ_pic32mz_ef_m_sk=pic32mz_ef_m_sk -no-legacy-libc
nbproject/Makefile-pic32mz_ef_m_sk.mk:679: recipe for target 'build/pic32mz_ef_m_sk/production/_ext/1029000301/mqtt_packet.o' failed
In file included from ../src/app.h:61:0,
from ../src/system_config/pic32mz_ef_m_sk/system_definitions.h:68,
from ../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_types.h:50,
from ../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_packet.h:34,
from ../../../../third_party/tcpip/wolfmqtt/src/mqtt_packet.c:27:
../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_client.h:61:54: error: unknown type name 'MqttMessage'

typedef int (*MqttMsgCb)(struct _MqttClient *client, MqttMessage *message,
^
../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_client.h:91:5: error: unknown type name 'word32'
word32 flags; /* MqttClientFlags */
^
../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_client.h:109:5: error: unknown type name 'MqttMsgCb'
MqttMsgCb msg_cb;

I've tried just calling functions from within app.c, but that also fails.

Also tried including all of the wolfmqtt files, but that doesn't help either (which I didn't expect it to)

Any guidance is greatly appreciated.

End goal is subscribe to a topic on a MQTT server (mosquitto) and publish to that topic from the PIC32.

Share

Re: WolfMQTT with MPLab Harmony - How to guide?

Hi smitthhyy,

In the wolfMQTT download you will find a directory:

wolfMQTT/IDE/Microchip-Harmony

That directory contains a detailed README that will get you started. You can also view it online in our github repository here:
https://github.com/wolfSSL/wolfMQTT/blo … /README.md

Let us know if you have any further issues getting setup with Microchip Harmony.


Cheers,

Kaleb

Re: WolfMQTT with MPLab Harmony - How to guide?

Hi smitthhyy,

I am the author of the wolfMQTT library and did the integration into Harmony. I just downloaded the Harmony v2.05 to test it out. You must be having some include issues. The build error doesn't make sense to me since `mqtt_packet.h`defines `MqttMessage`, which is included just above in mqtt_client.h.

As for v0.10 in Harmony it looks like Microchip hasn't been updating the library, so I will ping them about getting it updated.

For now the best solution is to download the latest from us directly and replace it inside the Harmony `third_party/tcpip/wolfmqtt`.
https://github.com/wolfSSL/wolfMQTT
Then you'll have to re-generate your Harmony code. The README.md Kaleb provided explains how to do this.

Let me know if that is helpful or not. If you continue to get errors please email us at support@wolfssl.com and include the project for reference.

Thanks,
David Garske, wolfSSL

Share

Re: WolfMQTT with MPLab Harmony - How to guide?

Hi smitthhyy & dgarske

Even I'm working on the similar task where I'm using PIC32MX370F512H custom target board communicating with wifi chip MRF24WN0MB. By following the online tutorials and sample example codes under harmony I could connect to access point.I've used  "wifi_easy_configuration" example project under "C:\microchip\harmony\v2_04\apps\tcpip" path as reference. My end goal is to add MQTT feature to this project and send data to the server.

Please help me in - How to proceed with implemening the use case and test it from the scratch.

I am new to MQTT, just know the theoretical basics.Please help me to go ahead by providing me necessary documents and sample projects in harmony for my use case.

Warm Regards
Jitendra

Share

Re: WolfMQTT with MPLab Harmony - How to guide?

Hi Kaleb
Can you please let me know briefly what  ''wolfmqtt_client" and "wolfmqtt_firmware" projects are individually meant for. If suppose I'm running ''wolfmqtt_client" where can I check if data is sent to the server? Under Mplab Harmony help I couldnt find explanation on these two projects. Please provide me that information.

Thanks & Regards
Jitendra

Share

Re: WolfMQTT with MPLab Harmony - How to guide?

Followed the instructions above and tried to build the 'wolfmqtt_client' project both in Mplab Harmony v2_04 and v2_05. Getting the build error below:

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/microchip/harmony/v2_04/apps/tcpip/wolfmqtt_client/firmware/mqtt_client.X'
make  -f nbproject/Makefile-default.mk dist/default/production/mqtt_client.X.production.hex
make[2]: Entering directory 'C:/microchip/harmony/v2_04/apps/tcpip/wolfmqtt_client/firmware/mqtt_client.X'
make[2]: Leaving directory 'C:/microchip/harmony/v2_04/apps/tcpip/wolfmqtt_client/firmware/mqtt_client.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/microchip/harmony/v2_04/apps/tcpip/wolfmqtt_client/firmware/mqtt_client.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** No rule to make target '../src/system_config/default/framework/net/pres/net_pres_enc_glue.c', needed by 'build/default/production/_ext/1278673032/net_pres_enc_glue.o'.  Stop.
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 843ms)


Please let me know what went wrong.

Share

Re: WolfMQTT with MPLab Harmony - How to guide?

Hi zoomto.jitendra,

The net_pres_enc_glue.c is a generated file from the Harmony tool. Under the networking section you will find a net presentation checkbox.

The wolfmqtt_client example demonstrates your basic MQTT client features such as connect, subscribe and publish. The `wolfmqtt_firmware` project demonstrates using MQTT for a firmware update example.

Thanks,
David Garske, wolfSSL

Share

Re: WolfMQTT with MPLab Harmony - How to guide?

Hi dgarske

I'm still getting errors. I guess there is an issue in BSP. I tried to compare the example projects directory tree of "mqtt_client"and "wolf_tcp_client"given under harmony. I'm attaching those files. Below is the project loading error which I'm getting in the IDE initially. Of course, there are other errors too. But, I believe they will be fixed if system_config directory is properly aligned which deals with BSP and framework under it. Please let me know what is the BSP you have chosen for successful building.

I believe example projects should never give build errors. Why is it so happening. Later on I need to implement this MQTT on PIC32MX370F512H custom target board communicating with wifi chip MRF24WN0MB as mentioned earlier. But I'm struck at running example projects itself.

Please help me in this regards.


project loading error:
=============
warning: Configuration "default" builds with "XC32", but indicates no toolchain directory.
info: Configuration "default" will build with toolchain "XC32" at "C:\Program Files (x86)\Microchip\xc32\v1.44\bin".
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\framework\net\pres\net_pres_enc_glue.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\framework\system\clk\sys_clk_static.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\config.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\system_config.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\system_definitions.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\bsp\pic32mx_eth_sk2\bsp_config.h" which does not exist in the disk. The make process might not build correctly.

Thanks & Regards
Jitendra

Post's attachments

wolf_tcp_client.PNG
wolf_tcp_client.PNG 16.99 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

Re: WolfMQTT with MPLab Harmony - How to guide?

Other file could not be attached earlier. I'm attaching it here.

Post's attachments

mqtt_client.PNG
mqtt_client.PNG 19.79 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share