Pages: [1]   Go Down
Author Topic: attiny85 + 20Mhz resonator + attiny core  (Read 1753 times)
0 Members and 1 Guest are viewing this topic.
Britanny
Offline Offline
Full Member
***
Karma: 0
Posts: 233
Mais vrai, j'ai trop pleuré, toute lune est atroce
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hye,

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

Code:
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
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 199
Posts: 12768
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Do you need the micros function?  Or delayMicroseconds?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8697
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From core_adc.h:

Code:
/*
  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:
#elif F_CPU == 20000000
  // 20 MHz / 128 = 156.250 KHz
  #define ADC_ARDUINO_PRESCALER   ADC_Prescaler_Value_128
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: