Bluetooth connection between smartphone and esp32 disappears (error 516)

Hello community, I encountered such a problem, after connecting the phone to esp32, the device works, if you stop it for a short time of 30 seconds - a minute, then error 516 appears, after which you have to re-select from the list and connect to the device. The whole problem is that this error is progressive and the device may appear this error even when it is working. The power supply of the entire circuit is 12 V (8x1.5V), 12V is supplied directly to l298n (2 motors 12V), after MP2307 mini-module step-down converter to power esp32 and mini-l298n (2 motors 5V) goes up to 8V, the last thing I remember was 6.4V. Maybe the problem is run down batteries but I want to hear your opinion.

Yes, one of the users reported having a similar problem, he solved it by connecting the esp to a stable power source. Try it.

this unit is a rc machine and unfortunately there is no extra space for a separate battery

So make sure the batteries are charged and the esp32 supply voltage doesn't drop much below 5v while the motors are running.
Also use good filters on the power supply, because motors can introduce a lot of noise.