How do I view the output from cliSerial/hal.console? I'm trying to debug my code and this seems like an important thing but I just can't find any good information on it.
tl;dr
I've been researching Pixhawk and the Ardupilot project for a long time but finally went ahead last week and got an IRIS+ to start testing. I'm a programmer so the first thing I did was get the build environment setup, change some non-critical code, and flash it. Success! My IRIS+ now starts up with the beginning of Final Countdown instead of the stock startup tone.
Moving forward I have some bigger code changes that will require debugging and I've scoured the internet but I just can't figure out how I'm supposed to view debug text like:
hal.console->println_P(PSTR("Where do I go?"));
I followed the Developer Wiring page to build an FTDI->DF13 connector because I thought that might be what I needed but that connects me to the NSH console and doesn't seem to be what I wanted.
Then I read that I could setup a serial connection on the USB com port. I connected with Putty at 115200 but I think that's giving me the gcs_send_text output and gives me a bunch of garbage looking data.
Maybe I'm going about this all wrong but I would really appreciate any advice with this so I can move on to coding. Thank you.
Replies
I was also looking for the console output for debugging purpose the other day..In the documentation it says serial 4/5 port, but got nothing there. I tried the microUSB port on Pixhawk (COM5 on laptop via USB). It did spit out a lot of garbage, but indeed output the messages I wrote too!
The workaround I had was encapsulating my message between a pair of markers, like hal.console->printf("%s %s %s", MSG_MARKER, "Here goes the real message", MSG_MARKER) and #define MSG_MARKER "@@" of which the characters are rarely seen in the garbage.. Then I wrote another program to go through the bytes from the port, and only display the characters between my MSG_MARKERs.
It's a bit tedious, but it works! Who knows what the garbage messages are??
Good to know I am not the only one. I am trying to get PMW output from the PX4. I tried the printf and the write commands to the UART and also to the console. I then use a microcontroller to try and read at the UART using python serial library. I get nothing. No output displayed. I tried to use putty to the COM port directly (via USB) - get all gibberish.
I will try what you recommend above, but there has to be a simpler way. I have posted thrice on diydrones till now and even on couple of google groups. No reply. :/
Did you ever find a solution to this? I'm in a similar position though trying to do something different. When I connect to the Pixhawk via USB and run "screen /dev/ttyACM0 57600 8N1" I see a couple of lines of messages and then the terminal window scrolls gibberish forever. Thanks.