How to recharge a bootstrap capacitor on an H-bridge with each transistor controlled with a pwm GPIO?
I found my mistake. H1's capacitor can charge through the motor if L2 is closed.
Thank you @Tony Stewart EE75 for holding on
   void set_force(float force){
        if(force == 0.0f) {
            L1.write(0.0f);
            H1.write(0.0f);
            L2.write(0.0f);
            H2.write(0.0f);
        } else if (force &gt; 0.0f) {
            L1.write(0.0f);
            H1.write(force); // there was &quot;1&quot; here
            L2.write(1.0f); // there was &quot;force&quot; here
            H2.write(0.0f);
        } else {
            L1.write(1.0f);
            H1.write(0.0f);
            L2.write(0.0f);
            H2.write(-1.0f*force);
        }
    }