Solved: Measure internal clock of an ATtiny84a

I soldered an ATtiny84a on my selfmade board and uploaded a simple sketch to see if it works. A LED is connected via resistor to TEST_PIN:

#define TEST_PIN        (A3)

boolean t_pin=false;

void setup() {

  pinMode(TEST_PIN, OUTPUT);

     while(1) {
      digitalWrite(TEST_PIN, t_pin); // LED ein
      t_pin = !t_pin;
      digitalWrite(TEST_PIN, t_pin); // LED aus

The LED is blinking by about a factor 15 slowlier than programmed. The timing of delay() is wrong.
The ATtiny is configured to run with internal 8 MHz clock.
I would like to measure the true clock frequency the ATtiny is running.

What can I do?

The fuse settings are probably wrong. Make sure that the "Divide by 8" fuse is not set.

I just uploaded the sketch with an USBasp. I have no access to the fuses.

Maybe, the programmer is not capable of setting fuses. Formerly I had the problem that the USBasp could not upload any sketch to a 328P controller. After uploading with an Arduino as ISP once, then also uploading with USBasp worked.

Have you an idea how to configure USBasp to burn fuses?

Sure you do. The Arduino's "Burn Bootloader" command will set the fuses appropriately for you, even when it doesn't actually load a bootloader. If you're using DrAzzy's ATtinyCore (and you probably should be), you can select 'ATtiny24/44/84 (no bootloader)" from your Boards menu, then set other CPU parameters the way you want them (also in the "Tools" menu), and then click "burn bootloader."

Or you can look up the desired fuse settings in the datasheet or an online fuse calculator and program them from the command line with AVRDude. It would look something like:

/Applications/ -C/Applications/ -v -pattiny84 -cusbasp -e -Uefuse:w:0xFF:m -Uhfuse:w:0b11010111:m -Ulfuse:w:0xE2:m

wow, thank you very much. This was the solution.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.