ATTiny84 - Interrupt-Problem

I want to port a project, written for the Arduino Mega to a AtTiny84.

I’m using the IRRemote library which officially supports the AtTiny84. But running the project on the tiny, it seemed to hang after enabling the IR-Receiver.

So I started to narrow the problem down to the timer setup code.

So, I extracted the timer code to a new sketch:

#include <avr/io.h>
#include <avr/interrupt.h>
#include <SoftwareSerial.h>

#define LED_1 0
#define LED_2 1
#define SERIAL_TX 2
#define SERIAL_RX 3

SoftwareSerial serial = SoftwareSerial(SERIAL_RX, SERIAL_TX);

void setup()
{
 pinMode(LED_1, OUTPUT);
 pinMode(LED_2, OUTPUT);
 serial.begin(9600);
 serial.println("Setup start.");

 cli();

 TCCR1A = 0; 
 TCCR1B = _BV(WGM12) | _BV(CS10); 
 OCR1A  = F_CPU * 50 / 1000000;
 TCNT1  = 0; 
 TIMSK1 = _BV(OCIE1A);

 serial.println("Enabling Interrupts...");
 sei();
 
 serial.println("Setup complete.");
}

void loop()
{
 static bool led;

 delay(1000);
 led = !led;
 digitalWrite(LED_1, led);
}

ISR(TIMER1_COMPA_vect)
{
 digitalWrite(LED_2, HIGH);
}

I expect LED 2 to light up, but it does not and the last thing I can see on the serial monitor is “Enabling Interrupts…”.

If I omit the sei()-statement, LED 1 blinks, but - of course - the interrupts are disabled.

If I set OCR1A to a higher value (F_CPU * 50 / 1000), I can see the serial monitor pushing “Se” in a loop. Like this: “SeSeSeSSSeSe…”. Is it rebooting?

Question #1: What is going on?
Question #2: What is WGM12. I can’t find useful info in the data sheet (page 111).

Addition:

  • I’m using the attiny-core from here.
  • I have a 100nF cap between GND and 5V (and also a 220µF).
  • I tried to setup Timer0 / Timer1 overflow interrupts, with no success.
  • Yes, I tested LED 2.
  • Nothing else is connected to the tiny. Only the pins used in the code and of course the pins needed for the ISP.