For whatever reason enabling timer0 overflow interrupt in phase correct PWM mode is no bueno.
I've looked through the datasheet multiple times now and can't find any hints as to why.
Starting to get tired of these issues to be honest.
Here's the code i'm testing stuff out with:
#include <avr/interrupt.h>
int Sampling_tick, Sampling_period;
ISR(TIM0_TOV0_vect){
//ISR(TIMER0_COMPA_vect){
OCR0B = 255;
Sampling_tick ++;
}
void setup() {
//TIMSK|=(1<<TOIE0); //enabling timer0 interrupt
PORTB = 0b00000011;
DDRB = 0b00000011; // set PB0 and PB1 as output.
OCR0A = 0;
OCR0B = 10;
TCCR0B = 0b00000001; // set clock source for timer
TCCR0A = 0b10100001; // enable and set waveform gen to slow pwm
// enable global interrupt
//sei();
/* enable timer 0 interrupt on counter overflow */
TIMSK|=(1<<TOIE0); //enabling timer0 interrupt
/* global interrupt enable */
//sei();
SREG |= 1 << 7;
}
void loop() {
//delay(10);
//OCR0A ++;
//OCR0B ++;
if (Sampling_tick >= Sampling_period){
// nothing happens here yet
}
}
//ISR(TIM0_TOV0_vect){
////ISR(TIMER0_COMPA_vect){
// OCR0B = 255;
// Sampling_tick ++;
//}
OCR0B = 10; works but no other
OCR0B = whatever; work after timer0 interrupt enable bit is set in TIMSK.

Ps: i'm using a spare Digispark board to test this code out because it's easier. Also i know interrupts (in general) on timer0 work because i have used them previously but i have no idea why they aren't working now.