I raised both the supply voltage and the amplitude of the input square wave up to 12V. Now the signal already looks like a triangle. However, the linearity is very poor at the top.
Yes, if you inject two
almost identical charges into a cap it will drift toward one of the rails. There is no defined DC point.
The
must use transistors restriction imposes more design effort than simply using a good opamp, as was already given in another thread.
There are two broad approaches to arbitrary
must use transistors restriction :
a) You can make a schmitt with thresholds at 2V and 3V and feed that back to two current sources.
This uses a single Cap and self centres on the schmitt thresholds, but such a schmitt is not trivial to get right.
b) You can create a square wave (as above) and use that to switch currents into a cap.
That is simple to define frequency (with the caveat some cross coupled monostables can fail to start), but it has no defined DC average.
Thus you need to add an additional DC centre circuit.