clkI/O 256 & 1024 (From prescaler) not working with driving PWM on Nano board I've been working with PWM in TIMER0 of my nano board.

So, it's working now and I know how to set OCR0A or OCR0B.

Then, I went to play with Clock Select Bits CS02 CS01 CS00 in TCCR0B.

0, 8 and 64 prescaler configurations worked as I also don't see the effect on the LED fade speed.

But the more problem I get is that 256 and 1024 prescaler don't work at all and the LED goes on all the time.

What is the problem?

The code:

void setup() {
    DDRD |= (1&lt;&lt;DDD6);
    TCCR0A |= 0xC1;
    TCCR0B |= 0x00; // this works for 0x01, 0x02, 0x03 only
    }

    void loop() {
    uint8_t i;
    for (i=0;i&lt;256;i++)
    {
      OCR0A = i;
      _delay_ms(1);
    } 
    }


regards,
The main problem is the prescaler on Timer0 is already configured to divide clock source by 64 CS01 and CS00 are set (0b00000011).

And you are using bitwise OR to "change" prescaler: TCCR0B |= 0x05; or TCCR0B |= 0x04;. But this'll result into the clock source 7 (0b00000111) - clock source is expected on T0 input counting on rising edge.