RAK3172-E what is the firmware download algorithm?

We already have quite a lot of devices, and now we need to update the firmware from RUI_3.5.1 to RUI_3.5.6. The devices have access to UART-2. But due to the fact that these devices are located in an inaccessible place, it is not convenient to access them from a PC with the standard “RAK Serial Port Tool” program. There is an idea to make a hardware bootloader for the STM32, the flash of which will contain a binary file for transferring it to the RAK3172-E.
Actually, the loading algorithm itself is of interest.

  1. Apply power
  2. Run the command “AT+BOOT”

Now I don’t understand in what form and when to transfer the binary file via UART-2.

The uploader is using the YMODEM protocol to send the firmware in binary format.
My colleague shared some info here

Thanks for the link. Only I can’t transfer the firmware properly. It seems that the transfer begins, but at some point a failure occurs. The crash frames are always different.
And then in general I can bring RAK3172 back to life, only by flashing it using “RAK Serial Port Tool”

Could be a problem in your ymodem implementation on your MCU.
Try to slow it down, put delays between blocks and double check that the ymodem protocol on your MCU is actually working.

I haven’t implemented a modem on the my host MCU yet. I tried it from the project in the link.
But it seems to me that the best solution is to make a programmer for Raspberry PI, and try the standard “RAK Serial Port Tool” for Ubuntu.