PWM free pins on Arduino UNO/ATmega328

Hi,

I need to generate a 25 KHz square signal. The Arduino UNO timers are already set up. My question is which pair (Timer, Pin) can be free to use without altering the Arduino's behaviour. I have no problems with C, C++ or even assembler; my problem is to break something inside the platform for using, for example, a system timer.

Any advice? Thank you in advance!

If you don't use analogWrite() no any pin will be configured for PWM. So you can use any. Timer0 is used for time keeping millis() so don't change its pre-scaler and don't use Timer0 overflow interrupt. You can still use Timer0 compare interrupts.

Some libraries use timers. You need to try it.
AFAIK Arduino prepares the timers for PWM even if no analogWrite is used.

Can you use tone()?