Finally got the square wave working perfectly.