Arduino Forum
>
Using Arduino
>
Microcontrollers
>
ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
Print
Go Down
Pages:
1
[2]
Topic: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
(Read 3561 times)
previous topic
-
next topic
mpcz
Newbie
Posts: 18
Karma: 0
[add]
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#15
Oct 16, 2017, 06:28 am
Hello,
upload to TINY85:
avrdude -B250 -c usbasp -p t85 -U lfuse:w:0x04:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m ....
The base frequency is reduced. 8x division does not work.
Where is the error?
Thanks, mpcz, 16.oct.2017
Smajdalf
Edison Member
Posts: 2,267
Karma: 148
[add]
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#16
Oct 16, 2017, 01:51 pm
Maybe you chande main clock prescaler in your code?
How to insert images:
https://forum.arduino.cc/index.php?topic=519037.0
mpcz
Newbie
Posts: 18
Karma: 0
[add]
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#17
Oct 16, 2017, 01:57 pm
Last Edit
: Oct 16, 2017, 02:03 pm by mpcz
Yes, the change in code "clock/8" works OK.
I need a change of "frequency and divider" via FUSE.
mpcz, 16.oct.2017
Smajdalf
Edison Member
Posts: 2,267
Karma: 148
[add]
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#18
Oct 16, 2017, 02:03 pm
The fuse sets prescaler to divide by 8. If you change it via code later the value from fuse is overwritten. I.e. if it is set by fuse to 8 and you set it to 8 too you get total prescaling 8 (~16kHz), not 64 (~2kHz). Isn't this your problem?
How to insert images:
https://forum.arduino.cc/index.php?topic=519037.0
mpcz
Newbie
Posts: 18
Karma: 0
[add]
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#19
Oct 16, 2017, 02:10 pm
Sorry, I do not understand.
I set fuses:
avrdude -B250 -c usbasp -p t85 -U lfuse:w:0x04:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
The code is empty. Frequency is 128k, not 16kHz.
What is wrong?
Thank, mpcz, 16.oct.2017
Smajdalf
Edison Member
Posts: 2,267
Karma: 148
[add]
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#20
Oct 16, 2017, 02:15 pm
Are you sure the code is empty? Are you sure no core/bootloader is present that sests the prescaler to 1? Try to add
-e
command line option to the avrdude command to erase possible remnants from the chip.
How to insert images:
https://forum.arduino.cc/index.php?topic=519037.0
DrAzzy
ATtiny Obsessee
Shannon Member
Posts: 12,185
Karma: 1735
[add]
https://www.tindie.com/stores/DrAzzy/
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#21
Oct 16, 2017, 04:53 pm
How do you know that it's running at 128khz?
ATTinyCore and megaTinyCore for all ATtiny, DxCore for DA/DB-series! github.com/SpenceKonde
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store
http://tindie.com/stores/DrAzzy
mpcz
Newbie
Posts: 18
Karma: 0
[add]
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#22
Oct 16, 2017, 09:02 pm
I have an ocsiloscope attached to pin # 3, there is an output clock.
mpcz, 16.oct.2017
Smajdalf
Edison Member
Posts: 2,267
Karma: 148
[add]
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#23
Oct 16, 2017, 09:32 pm
Last Edit
: Oct 17, 2017, 06:22 am by Smajdalf
How do you know the code is empty? Did you erase the chip? Try to read flash to be sure it is empty.
How to insert images:
https://forum.arduino.cc/index.php?topic=519037.0
DrAzzy
ATtiny Obsessee
Shannon Member
Posts: 12,185
Karma: 1735
[add]
https://www.tindie.com/stores/DrAzzy/
Re: ATMEL ATTINY85 - How to switch clock to 128 kHz or less?
#24
Oct 16, 2017, 09:33 pm
Sanity check...
Upload blink to it via ICSP, compiled for 128khz. Does it blink for 1 second or for 8 seconds?
I agree with your assessment though, it should be outputting - and running at - 16khz!
I would also consider trying to set the prescaler from the application (or at least read it out and blink an LED that many times, or something...)
ATTinyCore and megaTinyCore for all ATtiny, DxCore for DA/DB-series! github.com/SpenceKonde
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store
http://tindie.com/stores/DrAzzy
Print
Go Up
Pages:
1
[2]
Loading...