Go Down

Topic: attiny85 + 20Mhz resonator + attiny core (Read 3990 times) previous topic - next topic

mrbbp

Hye,

i've tried to had a description for an attiny85 @20 in the board.txt

Code: [Select]
attiny85at20.name= ATtiny85 @ 20 MHz  (external crystal; 2.7 V BOD)

attiny85at20.upload.using=arduino:arduinoisp
attiny85at20.upload.maximum_size=8192

# 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]

attiny85at20.bootloader.low_fuses=0x7F
attiny85at20.bootloader.high_fuses=0xDD
attiny85at20.bootloader.extended_fuses=0xFF
attiny85at20.bootloader.path=empty
attiny85at20.bootloader.file=empty85at16.hex

attiny85at20.build.mcu=attiny85
attiny85at20.build.f_cpu=20000000L
attiny85at20.build.core=tiny


but when i compile a sketch i've got an error about the speed
Quote
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  :smiley-red:

Coding Badly


Do you need the micros function?  Or delayMicroseconds?

johnwasser

From core_adc.h:

Code: [Select]

/*
  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
#else
  #error Add an entry for the selected processor speed.
#endif


Add:
Code: [Select]

#elif F_CPU == 20000000
  // 20 MHz / 128 = 156.250 KHz
  #define ADC_ARDUINO_PRESCALER   ADC_Prescaler_Value_128
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy