ATTiny85 and MIT core not running at 8Mhz?

joshuajnoble:

digitalWrite(4, HIGH);

digitalWrite(4, LOW);




and it spikes once per uS, which is, unless I'm delusional, 1Mhz. Anyone else run into this?

You're making an awful lot of assumptions there.

digitalWrite() takes more than one clock cycle to execute. You're doing two digitalWrites per pulse so it will take twice as long as that for one cycle (I'm very amazed you got 1MHz - the Tiny85 library must be quite well optimized!)

Try something like this:

const char p = 0x10;
while (true) {
  PINB=p;   PINB=p;  // One pulse...
  PINB=p;   PINB=p;
  PINB=p;   PINB=p;
  PINB=p;   PINB=p;
  PINB=p;   PINB=p;
  PINB=p;   PINB=p;
  PINB=p;   PINB=p;
  PINB=p;   PINB=p;  // Eight pulses
}

That will flip the output pin once per clock cycle (apart from when it goes back to the start of the loop). Two flips makes one complete pulse so you should see a 4mHz signal if you're running at 8mHz.