RC time comstant should be much smaller than period of the square wave.