Pixhawk4 hardware wont respond on upload commadn

Hi,

I am using windows 10 bash environment and have installed toolchain with that.
I used the bash terminal to build ‘px4fmu_v5-default’.
Once i use ‘make px4fmu-v5_default upload’ it says .(see the image). After that i tried to remove and insert the usb quite a times but it does work. But when i open qgroundcontrol it is successfully connected .

I have made custom code and need to upload it on pixhawk 4.

Do you close QGC when you try to update the firmware? Otherwise QGC will try to communicate to the port as well.

Yes, I have used QGC to update and calibrate sensors and stuff. then i close the window.(for your info - i am usinf latest Qgroundcontrol ). Do I need to specify any additional specs to make the upload? I mean specify the usb-com port or something else ?

No, as long as you close it, it should be ok.

Can there be problem with bootloader? and just for info I just wanted to know what basically the bootloader does ?

Hi ,
@JulianOes i tried uploading the code. I had closed the qgroundcontrol window. for your information I am using Pixhawk 4
For uploading the code i am connecting microusb from pixhawk 4 to my pc(see the image below)

.
Then i use ubuntu (windows 10 app) terminal and type make px4fmu-v5_default upload. It successully builds it but then waits on the screen (I have shown above).

Please guide me if any debug steps need to be taken inorder to get the upload done. There are two usb connection on the board 1. micro-usb and 2. USB on the board(see the image below) . I just wanted to clarify which port do i use for uploading the code?

Someone with Windows experience probably can help :smile: @MaEtUgR?

The Micro USB port should work.

I’ve actually never used WSL (Windows Subsystem for Linux) to flash a board. Direct Hardware access is IMHO the biggest weakness of WSL. I don’t think accessing the USB COM ports is working properly (yet) but I might be wrong. I quickly connected a board and checked ls /dev but the serial device doesn’t show up the same way as on linux and in Cygwin… Maybe you get it to work with further thinkering: https://blogs.msdn.microsoft.com/wsl/2017/04/14/serial-support-on-the-windows-subsystem-for-linux/, https://github.com/Microsoft/WSL/issues/1929

As an alternative you can check out the Cygwin Toolchain https://dev.px4.io/en/setup/dev_env_windows_cygwin.html. I’m successfully using it for my development and flashing.

2 Likes

Hi,

@MaEtUgR Thank you for the info on WSL. I am actually using Matlab PSP (Pixhawk Pilot support) and with that I have established the toolchain on windows 10 bash environment.
I have made built for px4fmu_v5-default using the PSP software. When i build the code (convert the matlab model into pixhawk built app) it was succesfully built (see the image below).

So i see that the built is successful and just uploading is required to start my custom made app.
My question is that can i use install cygwin toolchain and copy my built into the firmware folder and upload it? would it work ? or is there any other i can upload.

For your information - when i upload the built I found out that the px4/Firmware/tools/pyuploader.py script is called and it gets stuck somewhere.

Ah I see, you’re only missing the upload. For that you don’t need to install an additional toolchain. The upload also works fine natively under Windows. Just download native Python (I used 3.6 last time I did this) and pySerial pyserial. px_upload.py inside the Tools folder of the repo is the script which uploads the firmware: https://github.com/PX4/Firmware/blob/39d1751bbe1c62e197fb403472bd0e51cb1ebc81/Tools/px_uploader.py
You can run it with the following parameters:
python px_uploader.py --port COM10,COM9,COM8,COM7,COM6,COM5,COM4,COM3,COM2,COM1,COM0 C:\PX4\home\Firmware\build\px4_fmu-v5_default\px4_fmu-v5_default.px4
Just make sure the COM port of the device is listed and you’re uploading the correct file for the connected board (will error and not brick if you do it wrong).

@MaEtUgR Thank you sir for your advice . I will definitely try this. Currently , pixhawk is using COM4 port (connected via microusb). So do i have to mention all of the ports in --port command , or just com4 is fine ?
I was also wondering if i can upload my custom skematic using Qgroundcontrol

The ports you write after --port get checked hence if you know which one it is you can only mention that one. This can also be useful if you want to leave away some other COM ports e.g. from internal Intel devices that don’t respond and possibly make the script hang.

But be aware that the board when plugging in or rebooting has a different port while in bootloader mode and that’s the port you want to list. You see the switch in the device manager quickly after plugging the USB cable. The board might be on COM4 but the script only sends a reboot command there and waits until the board reconnects on a different COM port in bootloader mode.

@MaEtUgR So port do i mention. the one that i see in device manager (in my case COM4)?

I was wondering if the same can be done with Qgroundcontrol ?

Did the upload work?

So port do i mention. the one that i see in device manager (in my case COM4)?

If you flash on python natively running on Windows (like I suggested above) you mention the COM ports which are also shown in the device manager. But I suggest you pass a whole range like in my example command because the bootloader and the booted up PX4 have a different COM port and you want to capture both such that it sends a reboot to PX4 and then find the bootloader shortly after on the other COM port. Just take the whole list 0 to 10 if there are no other COM devices connected to your computer when you look at the device manager with the pixhawk not plugged in.

I was wondering if the same can be done with Qgroundcontrol ?

QGC has a different logic to find the board and does everything automatically. I don’t know of a way to specify the COM port manually but that doesn’t mean there is none.

The one with Qgroundcontrol worked for me. but thanks for the information on upload the code . It was edifying

1 Like