attiny85 + 20Mhz resonator + attiny core


i've tried to had a description for an attiny85 @20 in the board.txt ATtiny85 @ 20 MHz  (external crystal; 2.7 V BOD)


# Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms; [CKSEL=1111 SUT=11]
# Brown-out detection level at VCC=2.7 V; [BODLEVEL=101]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]
# Serial program downloading (SPI) enabled; [SPIEN=0]


but when i compile a sketch i've got an error about the speed

In file included from /Users/ercho/Documents/Arduino/hardware/tiny/cores/tiny/wiring.c:30: /Users/ercho/Documents/Arduino/hardware/tiny/cores/tiny/core_adc.h:55:4: error: #error Add an entry for the selected processor speed. /Users/ercho/Documents/Arduino/hardware/tiny/cores/tiny/wiring.c: In function 'init': /Users/ercho/Documents/Arduino/hardware/tiny/cores/tiny/wiring.c:257: error: 'ADC_ARDUINO_PRESCALER' undeclared (first use in this function) /Users/ercho/Documents/Arduino/hardware/tiny/cores/tiny/wiring.c:257: error: (Each undeclared identifier is reported only once /Users/ercho/Documents/Arduino/hardware/tiny/cores/tiny/wiring.c:257: error: for each function it appears in.)

i've quickly read the code in wiring.c and it seems need a value divide by 8 or 64? is it why the error?

in the datasheet from Atmel, we can use speed up to 20MHz! what i've misunderstood ?

some help?

regards sorry for my poor english, hope i'm clear :blush:

Do you need the micros function? Or delayMicroseconds?

From core_adc.h:

  From the '84 and '85 datasheets... By default, the successive approximation 
  circuitry requires an input clock frequency between 50 kHz and 200 kHz to 
  get maximum resolution.
#if F_CPU == 16000000
  // 16 MHz / 128 = 125 KHz
  #define ADC_ARDUINO_PRESCALER   ADC_Prescaler_Value_128
#elif F_CPU == 8000000
  // 8 MHz / 64 = 125 KHz
  #define ADC_ARDUINO_PRESCALER   ADC_Prescaler_Value_64
#elif F_CPU == 1000000
  // 1 MHz / 8 = 125 KHz
  #define ADC_ARDUINO_PRESCALER   ADC_Prescaler_Value_8
  #error Add an entry for the selected processor speed.


#elif F_CPU == 20000000
  // 20 MHz / 128 = 156.250 KHz
  #define ADC_ARDUINO_PRESCALER   ADC_Prescaler_Value_128