Yes, hansibull is wise. When hansibull replied, I was in the middle of typing up this:
The data sheet has some interesting stuff.
The CKOPT Fuse selects between two different Oscillator amplifier modes. When CKOPT is programmed, the Oscillator output will oscillate will a full rail- to-rail swing on the output. This mode is suitable when operating in a very noisy environment or when the output from XTAL2 drives a second clock buffer. This mode has a wide frequency range. When CKOPT is unprogrammed, the Oscillator has a smaller output swing. This reduces power consumption considerably. This mode has a limited frequency range and it can not be used to drive other clock buffers.
For resonators, the maximum frequency is 8MHz with CKOPT unprogrammed and 16 MHz with CKOPT programmed. C1 and C2 should always be equal for both crystals and resonators. The optimal value of the capacitors depends on the crystal or resonator in use, the amount of stray capacitance, and the electromagnetic noise of the environment.
I suggest study the data sheet regarding fuse settings. I see in your other thread
CrossRoads and hansibull were talking about full swing crystal, I think that is where the CKOPT fuse comes into play, but I am not an expert on that. You might try setting the CKOPT fuse and see what you get.
And double check your wiring. I suspect most unexplained weird crud is caused by bad ground connections. Check your power supply. Remove any of those motor connections if you have them connected. Make sure you have short wires or traces going to your crystal, and you may need different capacitor values on the crystal pins. Check the connection to ground on your capacitors.
I think it is interesting you can successfully communicate with Nano and can successfully program it, but have trouble with a simple program outputting a square wave. That makes me suspect a bad ground connection again... I guess you can tell I have an obsession with grounds. :-)
Disclaimer: I don't have experience with this particular processor, ATmega32. OMG I need to get away from reading data sheets and go for a walk....