Hi everyone,

I am frustrated in trying to get any kind of message out of my code with some sort of printf OR similar statement.  These would be temporary statements to be removed after debugging.

I heard that hal.console was part of a solution but could not get to work.

Any and all help would be very appreciated.

Thanks

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • I usually use hal.console like this:

    hal.console->printf_P(PSTR("Number = %f\n"),your_number);

    This shows up in the Mission Planner console window when connected by USB, and if you connect to 127.0.1 Port 2300 with Putty you don't see the other Mission Planner debug info.

    This works for me on APM, I don't have a Pixhawk so I'm not sure about that.

    Cheers,

    Sam

    • I'm in trouble using this method, I have nothing sent to any uart.

      I tried putty on COM port of my AUAV-X2 USB port without success, I got nothing from telnet:2300, terminal window of mission planner print lots of ascii chars but the messages didn't show, NSH console is working but none of my messages appear.

      I tried to connect FTDI on every UART and use hal.uartX->println("uartX"); within AP_Frsky_Telem.cpp init but got nothing.

      I certainly missed something but I don't know where. Does someone have an idea ?

      Regards,

      Nicolas.

      • I have to follow a very strict order on power up for it to work:

        0) TURN OFF Mission Planner!

        1) XMTR ON, ie my DX6

        2) Main 7.4v bus on

        3) Plug USB cable into Windows PC and Pixhawk

        4) Bring up PUTTY on Windows with COM5, 38400 baud, serial

        5) ARM the Pixhawk

        6) 5 v bus on to power receiver

        7) TREX motor controller on

        8) Done.

        The PUTTY screen should now have streaming characters.

        Click on the margins of PUTTY and it will pause for you to read the stream.

        Hope this helps

        Cheers

    • Sam,

      THANKS a million!

      I got it working finally with PuTTY using COM5, 38400, 8 bits, 1 stop, no parity and XON/XOFF.

      I use the USB cable to the PC from the Pixhawk.  It does take exact timing and sequencing to get the ports open just right with the RC Spektrum running.

      Now I can use hal.console->printf's just about anywhere I have tried and get great data values in real time from the Rover sitting on my desk.( wheels up)

      I have been looking for this solution for over 3 weeks.  Now I can get moving on some new code.

      Cheers

      Jim

    • Sam,

      When you made the connection to Putty,what were your params for the connection?  I cannot get mine going yet.

      Serial port? 

      Baud Rate?

      Bits?

      Stop Bit?

      Parity?

      xon/xoff?

      Also I am guessing in Putty you used 127.0.0.1:2300 on a "Serial" connection.  Is this correct?

      Thanks

      Jim Calvert

  • Developer

    try looking here http://dev.ardupilot.com

    But you can connect a terminal to serial port 4 , I'll look for the details later

    • Hi Bill,

      I have been scouring the web and found that there is a solution using cables and Serial Port 4/5.

      Apparently, if you take a DF13 connector and solder it to mate with a FTDI / USB cable.  That part is no problem, I can handle the pin-outs etc.

      What I am concerned about, is what I get for my trouble in terms of debugging capability.

      Will it drive a serial terminal in my Windows PC such that I can see printf's which I sprinkle through my code?

      Also, what terminal program is best for the PC?  Can you fill in some details please.

      Thanks

      Jim Calvert

      • A quick and dirty way to get a debug message to the "Messages" tab in mission planner is to use the function 'gcs_send_text_P''  like this.

        gcs_send_text_P(SEVERITY_HIGH, PSTR("Some message"));

        You'll see a few of these scattered around the Ardupilot code (mainly the *.pde files). You'll need to be connected via USB or other telemetry to see them of course. 

        Hope that helps.

        • Hi James,

          Have you tried this and if so, what terminal program did you use in the PC?

          Do I have to go through Mission Planner at all?

          Thanks

          Jim Calvert

          • Hi Jim,

            This function is for sending text to ground control stations. I use it with the messages tab in mission planner (one of the the tabs under the artificial horizon). No console needed, but it only works when connected to mission planner.

            I've used it many times for quick and dirty checking of things, or to add debug to understand how something works in the arduplane code.
This reply was deleted.

Activity