I am using a Pixhawk board and learning the ArduPilot codebase according to the dev’s guide. So far when I was learning the codes, I uploaded the example sketches like AHRS_Test and INS_Generic and could successfully watch the outputs at the consoles using the command provided " mavproxy.py --setup --master /dev/serial/by-id/usb-3D_Robotics_PX4_FMU_v2.x_0-if00 ".
However, for examples like Storage_test, UART_test or even the simplest Hello, I can upload the sketches to the board yet I cannot receive any outputs at the console, even though there are also " hal.console->printf " lines in the codes just like the INS and AHRS examples.
So I was wondering what kind of problems could these be? Configuration problem or I should use different ways to watch the console instead of mavproxy?
I once suspected that the code of AC3.5 and higher version wasn’t working. But today I have a try , and i think just because the console port is changed. You can try other serial ports such as serial port 4,There may be surprises.
In the picture , my pixhawk works at the main branch.The USB console doesn’t work ,but other serial ports can work.
Yeah that kind of makes some sense since I only used the USB-serial (serial 1 - uartA) and couldn’t watch anything.
But still the problem remains right? Serial 1, or uartA, is not accessible for some reason. I was searching about this issue and got this
https://discuss.ardupilot.org/t/problem-running-the-example-sketches-on-a-pixhawk/11780/4
I haven’t tried it out yet cause I don’t have any cable for connecting serial 4/5 (debugging port).
If you try this, the uartA should work properly.
Add “hal.scheduler->delay(2000);” to this linehttps://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_HAL/examples/UART_test/UART_test.cpp#L33. For example
But i don’t know why. I guess AC3.5 and higher version ardupilot change the code before “setup”.
No luck…
BTW, could you please check your DM? I sent a message
I got your E-mail.
I think uartA and USBconsole are both need “uartA” be initialized.You can try my Binary file"UART_test.px4". It should be working.
UART_test.px4.zip (228.1 KB)
Yeah it worked, thanks much.
Given the fact that the code I use is exactly the same as yours, I think the problem lies in building the code and uploading it.
I used waf to build the code and upload it onto the board under the environment of Ubuntu 16.04 on VMware, and I see your method is to compile it into .px4 and upload the .px4 using QGroundControl/Mission Planner under Windows, right? I am wondering what compiler did you use?
VMware, ubuntu14.04, waf. I’m not sure the arm-none-eabi version,maybe 4.93.
I usually use the linux terminal with “–upload”. It can work as well as .px4 does.
UPDATE: Seems like they fixed the problem for Ardupilot 3.5.4.
But further when I tried Storage_test, the hal.console->printf still doesn’t work.
see this.The UART_test have one initialize for uartA,it just doesnot work,so one delay can fix it.For other examples,some have the initialize for uartA and have enough time to do initialize,like AHRS_test.The Storang_test maybe do not have the initialize.
BTW,this is my pull. I am first try to make contributions and … I can’t believe they’re so efficient.
Currently I am experimenting with the example sketch Printf, similarly, after building and uploading the original code to pixhawk, nothing could be observed from the com ports (neither the console port-uartA nor the debugging port-uartE).
I tried to add the line “hal.console->begin(57600);” followed by a delay of 1s, yet it did not help the situation.
The delay should be before the initilize.
If you want to use other serial port. You just need add initialize like uartA; And use printf like “hal.uartB->printf();”
Yes, I found that out.
So after repeated experiments, the only remaining problem was that using waf in terminal to upload the firmware to the board under Ubuntu causes problem with the uartA communication while using MissionPlanner or QGroundControl to manually upload the firmware under Windows is good.