How to get maximum frequency pwm from AT tiny 85 (newbie)

Hey!

I'm trying to get the maximum frequency pwm from my attiny85. I am programming it using an arduino uno.

I have tried changing the prescalers, but the max i can get is about 4 kHz.

The 85 that i have has a clock of 20 MHz.

Here is the code I have so far

void setup() {
  // put your setup code here, to run once:

TCCR0B = TCCR0B & 0b11111000 | 0b001 ;
}

void loop() {
  // put your main code here, to run repeatedly:
analogWrite(0,127);
}

The programmer is "Arduino as ISP"
Board: ATtiny25/45/85
Processor: ATtiny85
Clock: external 20Mhz (there is no option for internal 20MHz)

thanks

Which core are you using? If you use TinyCore then it has an option in the 'Tools' menu to set the high-frequency timer to 64MHz.

okay i downloaded the tinycore and set the timer to 64Mhz, but im still getting around 4 kHz with the same code. I tried changing it to timer one B instead of timer zero, but it didn't help.

If you're manually playing around with the timer settings then that could well be upsetting things.
In addition, Timer1 is the high-speed timer- that outputs on PB4 (so you'd use analogWrite(4,127)).