Firmware serial debugging

Hello,

I’m trying to understand how to debug the firmware, to get messages like the one we can find here: https://github.com/spark/firmware/blob/v0.4.4/system/src/system_cloud.cpp#L576

So, I tried to clone the spark/firmware github repositry, create a branch from v0.4.4 tag, and upload the firmware using:

cd modules/
make clean all program-dfu  PLATFORM=photon DEBUG_BUILD=y PARTICLE_DEVELOP=1

All three binaries was uploaded successfully to the device, but I still don’t have any error message when using

particle serial monitor

I tried to connect with minicom too, but w/o success.

So there’s more information here: https://github.com/spark/firmware/blob/latest/docs/debugging.md

Hello @kennethlimcp,

thanks for your reply but it’s the documentation I followed (i forgot to mention it). But where to place the:

 SerialDebugOutput debugOutput;          // default is 9600 and log everything

code? and don’t tell me it’s in the user application because it’s the firmware I want to debug, not my app :smile:

Thanks

Yes, it goes in your application in global scope just as it says in the docs.

Sure I already tried that, but I don’t have any messages from the firmware. I want to debug a handshake issue with own server, so I need to use serial_dump from communication/src

Output messages should be displayed on the USB serial (ttyACM), right?

Yep. You’re not going to get the serial_dump messages from the comms lib. It would be best to change them to debug statements.