I did not actually have a solar panel there, only a dc power supply, but if the PWM duty cycle was reduced, increasing the on time of the lower mosfet, the whole circuit operates as a dc boost converter, drawing current from the battery and producing an essentially ever rising dc output voltage until something breaks down. Usually the upper mosfet.
So the lesson was, active rectifiers work fine driving a resistive load, but if you try driving a battery you might be in trouble if the mppt software reduces the duty cycle far enough.
I never thought this bi directional power feeding effect with a buck regulator could ever be useful for anything at the time, but I have since done more testing and have come up with this rather interesting topology:
![Charging a 24v bank from a 48v bank...or vice versa...how to do it? Can it done? 14797-0](https://www.fieldlines.com/index.php?action=dlattach;topic=150329.0;attach=14797;image)
The interesting thing is that current can flow either way from one battery to the other, depending on duty cycle and relative battery voltage.
At 100% duty cycle the upper mosfet is always on, the lower mosfet always off, and two equal voltage batteries are solidly in parallel.
At exactly 50% duty cycle one battery can have twice the voltage of the other, and no current will flow except for a small ripple current that flows in and out of both batteries, but there is no net dc current transfer.
If one battery is slightly higher or lower than the 2:1 voltage ratio current will flow either way until the batteries settle at the 2:1 voltage ratio.
You can charge or discharge either, and both batteries will track each other.
Its also possible to have odd ratios of battery cells, it does not have to be 2:1.
As long as the duty cycle reflects the ratio of the number of cells difference in the two batteries, and the voltage ratio, it also works. So it should be possible to connect say four cells and sixteen cells together for example.
Fixed known exact ratio duty cycles are easily generated either in software or hardware with digital counters.
So it should be pretty easy to implement a circuit to do what the original poster was asking.
Its early days yet. The cells I have just ordered from China are supposed to take eight weeks to Australia, but the Geopolitical situation with hundreds of cargo ships anchored off China not being able to load or unload does not look good.
I cannot do any actual worthwhile power testing without more cells, but the basic concept of this is already proven.