Hi group. I am having a problem with frequencies measured on an ATTiny85 with an oscilloscope using the AnalogWrite command. I have the ATTiny running at 1 MHz internal clock and I measure an output frequency of about 491 Hz on the PB0 and PB1 outputs (physical pins 5 and 6.) I would have expected the output frequency to be 1/8 that frequency or about 61 Hz. Here is the configuration I am using (I'm trying to be as complete as possible in the configuration description):
- Arduino 1.85 on a Windows 7 machine.
- I am using the ATTiny core by Spence Konde at: GitHub - SpenceKonde/ATTinyCore: Arduino core for ATtiny 1634, 828, x313, x4, x41, x5, x61, x7 and x8
- I set up the bootloader for the following configuration:
Board: ATTiny 25/45/85
Timer 1 clock: CPU
Clock: 1MHz internal
Save EEPROM: EEPROM retained
B.O.D. level: B.O.D. enabled (1.8V)
For an 8 MHz processor, the output frequency should be 8MHz divided by prescalar value of 64, divided by 256 (8 bit counter running in fast PWM mode) or 488.2 Hz.
The ATTiny is behaving as though it is using an 8 MHz internal clock instead of a 1 MHz internal clock or the ATTiny core is using a different prescalar value than an Arduino Unu ior Nano? I need help tracking down why the PWM frequencies ar not as expected for a 1 MHz internal clock. My application require a PWM frequency in the range of 100-150 Hz. I am reluctant to start writing registers directly without first understanding what's going on.
Thanks for your help.