About the diode for the Xiao ESP32-S3's voltage input

I am trying to power the XIao ESP32-S3 with a 16.8V battery, that I step down to 5.2V with a buck converter with fixed output.

The wiki says that I can use the 5V pin as a voltage input as long as I place a diode with its anode on the voltage input and its cathode on the 5V pin. This will inevitably cause a voltage drop, which in my case means that the ESP is only being powered by around 4.5V. This seems to be causing problems, as some code that runs fine when I power the ESP via USB stops working when I switch to battery power.

Therefore, I would like to know what the purpose of this diode is, and whether I can use an adjustable buck to feed 5.8V into the ESP to compensate for the diode voltage drop, or if this loss is already being considered in the wiki’s advice.

I believe a diode would be connected to prevent USB5V from supplying current externally through the 5V pin.
On the other hand, since there is no diode on the USB side, if a voltage higher than 5V is supplied from outside, current may flow into the USB side (PC side).
Whether USB 5V or external 5V is supplied, it will be converted to 3.3V by the on-board voltage regulator, so I do not see how this is related to the code not working.

Does this mean that I can omit the diode if I don’t use the USB-C port?
I say this because what I get from your answer is that the diode is there to protect the device supplying power via USB-C, which in my application won’t be present.

If there is no connection to USB, I believe the diode on the 5V pin can be omitted.
If you don’t use USB, how would you debug and upload?

I’m using HardwareSerial and a TTL-to-USB converter for debugging, and I just switch off battery power before uploading, which for now works.

I’ve just tested it and everything works fine now that there is no voltage loss on the diode, so the ESP can get the full 5.2V to use in its voltage regulator. Thank you.