Can't flash custom firmware

I have been trying to flash firmware (following the instructions on Build ArduSub · GitBook) for a few hours now. I started out on Ubuntu on a VirtualBox machine. It was not working so I tried it on windows using WSL. I can compile no problem, but once I try to upload it to the PixHawk It just get stuck at
Loaded firmware for 9,0, size: 1044400 bytes, waiting for the bootloader…
If the board does not respond within 1-2 seconds, unplug and re-plug the USB connector.

I have tried unplugging and plugging back in, no change. I have tried multiple USB cables, no change. I can flash stock firmware just fine using QGC. I tried flashing a binary of the firmware using QGC, but that just made is so the pixhawk would no longer talk to QGC. I have not changed the firmware I cloned from github, so it should be the same as the QGC firmware (although that is V 3.5.4 and the online instructions tell you to use tag 3.6).

Any help would be greatly appreciated as I need to be able to flash custom firmware in order to use a custom frame.

Hello,

I just tested and ti ran fine in my machine. Keep in mind that the bootloader is identified as a different USB peripheral:

[16767.218618] usb 1-2: New USB device found, idVendor=26ac, idProduct=0011, bcdDevice= 1.01
[16767.218620] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[16767.218621] usb 1-2: Product: PX4 BL FMU v2.x
[16767.218622] usb 1-2: Manufacturer: 3D Robotics
[16767.218623] usb 1-2: SerialNumber: 0

This is my Pixhawk:

[16781.740972] usb 1-2: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00
[16781.740975] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[16781.740977] usb 1-2: Product: Pixhawk1
[16781.740978] usb 1-2: Manufacturer: ArduPilot
[16781.740980] usb 1-2: SerialNumber: 1E0043000951363335333536

Maybe the bootloader device is not being forwarded to the virtual machine.

Hi Willian,

Thank you so much for the reply. So what I figured out late last night is that the QGC program that is suggest on the bluerobotics instructions (3.2.4 Rev 6) for some reason once flashed with the custom firmware is not able to establish a connection with the pixhawk. I tried the latest stable version (3.5.4) and it is able to flash the binary and establish a connection with the pixhawk. That was on my windows machine. The Virtual machine is not able to flash, I think as you said there is an issue with forwarding the device to the VM. As a note I did follow the instructions for grabbing the tagged V3.6 of ardusub, but it states that it is V3.6 (Beta) in QGC, so not sure if that is contributor the problem or not.

So for now I will just use GCS to flash. I still can’t get WAF to upload and flash the code, but it is fine as long as I have a method I can move on.

Thanks.

Hi Robert,

That is in fact a beta. We are suggesting that for development because setting up the build environment for 3.5.4 is annoying to setup, and 3.6 should be out of beta in a few weeks/months.

You can find the older instructions for 3.5.4 here.

Ok very good. Thank you Willian I will try that version.

Hi Willian,

I tried the stable version. I am on Ubuntu 18.04.2 and am having issues. When I run the tools script to install things from the ardupilot folder I get this “E: Package ‘realpath’ has no installation candidate”. If I continue on and try to compile I get this

"[13/14] CMake Build px4 msg_gen
[ 0%] Built target git_genmsg
[ 50%] Built target git_gencpp
[100%] Generating uORB topic multi headers for nuttx
python import error: No module named em

Required python packages not installed.

On a Debian/Ubuntu system please run:

sudo apt-get install python-empy
sudo pip install catkin_pkg

On MacOS please run:
sudo pip install empy catkin_pkg

On Windows please run:
easy_install empy catkin_pkg

CMakeFiles/msg_gen.dir/build.make:316: recipe for target ‘src/platforms/nuttx/px4_messages/px4_actuator_armed.h’ failed
CMakeFiles/Makefile2:100: recipe for target ‘CMakeFiles/msg_gen.dir/all’ failed
CMakeFiles/Makefile2:107: recipe for target ‘CMakeFiles/msg_gen.dir/rule’ failed
Makefile:210: recipe for target ‘msg_gen’ failed
make[3]: *** [src/platforms/nuttx/px4_messages/px4_actuator_armed.h] Error 1
make[2]: *** [CMakeFiles/msg_gen.dir/all] Error 2
make[1]: *** [CMakeFiles/msg_gen.dir/rule] Error 2
make: *** [msg_gen] Error 2

Waf: Leaving directory `/home/rob/ardupilot/build/px4-v2’
Build failed
→ task in ‘px4_msg_gen’ failed (exit status 2):
{task 140074105055904: cmake_build_task → }
[‘/usr/bin/cmake’, ‘–build’, ‘/home/rob/ardupilot/build/px4-v2/modules/PX4Firmware’, ‘–target’, ‘msg_gen’]
"

Any thoughts?

Thanks

Also I did run
sudo apt-get install python-empy
sudo pip install catkin_pkg

That did not help.

Check your default python version. You may be installing these things to a python installation while Ardupilot tries to use the other one to build.