FIrmware upload via UART (bootloader issue)

I am using UART for communicating between Pixhawk and Rasperry-pi that runs MAVSDK server. I am trying to upload firmware via the same UART port. I have used the UART port defined in the bootloader of px4_fmu-v5 (in the bootloaders repo). When performing the firmware upload using with argument that defines the UART port (device) that is used, the uploader does not identify the board. The uploader sends the SYNC code (x21x20), receive some junk data sent probably by the mavlink that runs on the pixhawk. Then, the uploader sends a reboot request to mavlink, which is probably not received in the pixhawk. I have tried several bauds, and the reboot request send by the uploader is not received/processed. Note that the works fine when done over USB.
Any ideas or thoughts on how to solve this problem.


did you manage to successfully update the firmware via uart? Iā€™m trying to do the same, but the script gets stuck at
Loaded firmware for board id: 53,0 size: 1836880 bytes (93.43%), waiting for the bootloader...

How did you power the flight controller when updating via uart?