PIC32MZ - Debugging MQTT demo output

freeRToes wrote on June 02, 2018:


I did porting of Amazon FreeRTOS libraries into MPLAB Harmony project together with demo files.
My harmony configuration was as close as I could understand from system_config.g and other system_xxx files. Then for the rest I just replaced with harmony version configurations with the ones from the AWS demo including WILC1000 drivers.

So my device seems to be running demo ok, I receive Hello world messages and the ACK ones too. But serial print out is messed up.
I get lines like :

[Echoing] Message returned with ACK: 'H57 4351 [MQTT] MQTT Publish was successful.


88 9391 [Echoing] Message returned with ACK: 'H85 9391 [MQTT] MQTT Publish was successful.
86 9391 [MQTT] Notifying task.
87 9391 [Echoing] Command sent to MQTT task p; 9411 [MQTT] Received message 0 from queue.

Or like this last one

158 24471 [MQTTEcho] Echo successfully published 'Hello World 4'
159 24501 [Echoing] Sending command to MQTT task.
160 24501 [MQTT] Received message 0 from queue.
161 24502 [Echoing] Sending command to MQTT task.
162 24502 [MQTT] Received message c0000 from queue.
163 24571 [IP-task] Socket sending wakeup to MQTT task.
164 24571 [MQTT] Received message 0 from queue.
165 24610 [IP-task] Socket sending wakeup to MQTT task.
166 24610 [MQTT] Received message 0 from queue.
167 24631 [Echoing] Command sent to MQTT task passed.
172 24631 [Echoing] Message returned with ACK: 'H169 24631 [MQTT] MQTT Publish was successful.
170 24631 [MQTT] Notifying task.
171 24631 [Echoing] Command sent to MQTT task passed.
172 24631 [Echoing] Message returned with ACK: 'Hello World 4 ACK'

It seems that part of the string is being messed with. Or like in this last sample it seems like there is a repetition of messages as there is message returned with ACK 'H169 and only after that Hello World 4 ACK.

I never really worked with SPI DMA if that could be something or maybe somewhere buffers are missing things. I am not sure.

Could someone help me our or have any ideas?

I also included full demo printouts in the attachments.

SarenaAtAws wrote on June 04, 2018:


Could you provide the system_xxx.h files and linker script, that you are using, so that we can verify it against the original system/peripheral setup?


freeRToes wrote on June 05, 2018:

Thank you. So I added all my system_xxx files and the linker file I was using the one from the aws demo since it had configurations for bootloader

Gaurav-Aggarwal-AWS wrote on June 06, 2018:


Thank you for sharing those files. It seems that the output from two different tasks is getting intermingled. Are you using aws_logging_task_dynamic_buffers or are you directly printing output? The logging task should be the only task printing to serial.


freeRToes wrote on June 06, 2018:

Yes, I am using aws_logging_task_dynamic_buffers and only configPRINTF() in my tasks. I am also including FreeRTOS configuration files where configPRINTF is being defined.
main.c is identical as from AWS demo. The way I include my other custom apps is inside aws_demo_runner.c but this happens without using any custom apps. Inside Harmony configurations I set up as in the attached picture. Just console and debug system services.

Gaurav-Aggarwal-AWS wrote on June 06, 2018:

That seems correct. At this point it looks like we need to take a closer look. Will you create a minimal project to demonstrate the problem and share with us so that we can take a look?


freeRToes wrote on June 06, 2018:

I discovered that one of the mistakes. I was using BufferAllocation_2.c from

and now I replaced with

Things got way better. But still every few minutes some random character messsages. But not every second message as it used to be.

freeRToes wrote on June 08, 2018:

I just cleared out aws_clientcredential.h, aws_clieantcredential_keys.h and aws_codesign_keys.h
MPLAB harmony paths should be set accordingly and I used AWS library relative paths from AWS demo folder next to migration app folder.

abhijit-AWS wrote on January 18, 2019:

Hello !
This is fairly old thread, Do you still need help with this issue ?