Timer frequency calculation for UNO/Atmega328
Your comment:

TCCR2B |= (1 &lt;&lt; CS21) | (1 &lt;&lt; CS20); // 1:64 prescaling for timer 2


doesn't match the actual setting (= 1/32)

Also there are some issues with setting Timer2 CTC mode, it's better to set mode, then OCR2A + TCNT2 + interrupts and then Prescaler to start the timer. It behaves as there is OCR2A=0, so the frequency is much higher than expected.