a timer that goes logic high or low every 15mins ( using tiny85 chip)

Thread Starter

timtim1234

Joined Nov 30, 2023
246
ok after some more reading just to add info for other to see in this thread:

To READ THE LOCK fuse setting using a UNO R3 with an ISP programmer hooked up, this is the command line for avrdude program:

avrdude -c arduino -p t85 -P COM6 -b 19200 -U lock:r:-:h

NOTE: change your com port number ( COM6 line) to what your programmer is hooked up to!
If you get errors, then change the -c line to this -c stk500v1

To use Windows GUI version of avrdude (AKA avrdudess) with your UNO R3 using an ISP programmer, you MUST set the programmer to Arduino for bootloader using STK500 v1 protocol!!
it will show the fuse setting in the fuse & lock bit window in the program when done reading

when you have this working, you will get this screen:
>>>: avrdude.exe
Loaded 145 programmers and 347 MCUs
Reading lock bits...
>>>: avrdude.exe -c arduino -p t85 -P COM6 -b 19200 -U lock:r:-:h
SUCCESS: Read lock bits
Reading lock bits...
>>>: avrdude.exe -c arduino -p t85 -P COM6 -b 19200 -U lock:r:-:h
SUCCESS: Read lock bits

caution: you may not be able to fix the chip so read and write will work!!!

Now to lock the tiny85 from reading and writing, change the hex for the lock bit to this:
avrdude -c arduino -p t85 -P COM6 -b 19200 -U lock:w:0xC0:m

If you get errors, then change the -c line to this -c stk500v1

Some websites say this:
0xC0: This configuration prevents both reading and programming of the flash and EEPROM memory, fully locking the device.

Some websites say this:
0xFC This configuration prevents both reading and programming of the flash and EEPROM memory, fully locking the device.
The link that was posted in this thread, said this
https://eleccelerator.com/fusecalc/fusecalc.php?chip=attiny85&LOW=62&HIGH=DF&EXTENDED=FF&LOCKBIT=FC

When you do this, from what it sounds like from some websites say tiny85 can only be reprogrammed after a full chip erase, which will also erase all contents of the flash memory. Not sure if this is done with an ISP or HVP programmer, I will find out soon..LOL

I haven't tested this yet because I have to build the HVP programmer. I hope to do this soon

I hope this helps other people and thanks again to all that has helped too :)
 
Last edited:

LesJones

Joined Jan 8, 2017
4,511
Re your post #186
To make the ATtiny85 unreadable you need to clear bits 0 & 1 in the lock fuse byte. I.E set the lock byte to 0xFC instead of the default value of 0xFF (Rember what I told you about the reverse logic where a zero enables the function associated with that bit.) Note this also makes it unwriteable.
Loading the boot loader does not make the chip faster. It is the fact that it also changes the low byte from it's default value of 0x62. (I noticed this after re loading the 15Min_timer.hex file to the chip that had been programmed with the boot loader. The led on the 0.5 hz output was flashing faster than normal.) I don't know how yoy issued the commands to avrdude with the 3 chevrons prompt. The prompt in command line mode is normally the full directory path followed by a single prompt.

Les
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
Re your post #186
To make the ATtiny85 unreadable you need to clear bits 0 & 1 in the lock fuse byte. I.E set the lock byte to 0xFC instead of the default value of 0xFF (Rember what I told you about the reverse logic where a zero enables the function associated with that bit.) Note this also makes it unwriteable.
Loading the boot loader does not make the chip faster. It is the fact that it also changes the low byte from it's default value of 0x62. (I noticed this after re loading the 15Min_timer.hex file to the chip that had been programmed with the boot loader. The led on the 0.5 hz output was flashing faster than normal.) I don't know how yoy issued the commands to avrdude with the 3 chevrons prompt. The prompt in command line mode is normally the full directory path followed by a single prompt.

Les
ok thanks also with it running faster i would assume the 15 min timer was also running faster too?
 

be80be

Joined Jul 5, 2008
2,395
It don’t matter if the clock is 1 megahertz or 20 if your code knows what it is only time you’ll be off is if you set it wrong in code the arduino ide you pick chip and clock but you can change clock on code that you said had a 8 megahertz clock I loaded a blinky on 1 megahertz and then later change to 8 megahertz bootloader it only flashed boatloader the the blinky code ran way faster but with the right settings your time will be right
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
It don’t matter if the clock is 1 megahertz or 20 if your code knows what it is only time you’ll be off is if you set it wrong in code the arduino ide you pick chip and clock but you can change clock on code that you said had a 8 megahertz clock I loaded a blinky on 1 megahertz and then later change to 8 megahertz bootloader it only flashed boatloader the the blinky code ran way faster but with the right settings your time will be right
ok i see what you mean also if you have the time be adjustable using a potentiometer that would fix the time if it was off to.
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
Re your post #186
To make the ATtiny85 unreadable you need to clear bits 0 & 1 in the lock fuse byte. I.E set the lock byte to 0xFC instead of the default value of 0xFF (Rember what I told you about the reverse logic where a zero enables the function associated with that bit.) Note this also makes it unwriteable.
Loading the boot loader does not make the chip faster. It is the fact that it also changes the low byte from it's default value of 0x62. (I noticed this after re loading the 15Min_timer.hex file to the chip that had been programmed with the boot loader. The led on the 0.5 hz output was flashing faster than normal.) I don't know how yoy issued the commands to avrdude with the 3 chevrons prompt. The prompt in command line mode is normally the full directory path followed by a single prompt.

Les
I forgot to ask was you able to unlock/fix the chip? if so using what programmer? and i don't know what you mean by avrdude with the 3 chevrons prompt?
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
Why are you so concerned with locking the code in your chip?
I am not really, while reading about programming, etc I came across that info and thought is kind of neat feature, so I wanted to learn more about it and play with that feature too.
 

MrChips

Joined Oct 2, 2009
34,828
I am not really, while reading about programming, etc I came across that info and thought is kind of neat feature, so I wanted to learn more about it and play with that feature too.
No, you don't want to do that. In other works, don't mess around with the security bit.
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
No, you don't want to do that. In other works, don't mess around with the security bit.
Best way to learn is to mess around, if I damage a chip not a big deal. And I want to build a HVP programmer I have room on my isp programmer board that i made so why not. :)
 

BobTPH

Joined Jun 5, 2013
11,524
I am not really, while reading about programming, etc I came across that info and thought is kind of neat feature, so I wanted to learn more about it and play with that feature too.
Of all the capabilities of a micro you could learn, this one is arguably the least useful to a hobbyist.
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
Of all the capabilities of a micro you could learn, this one is arguably the least useful to a hobbyist.
That could be and maybe in the future I will learn other "better" ones, but of course I guess it depends on what you want to do with the mirco too. In my case, the tiny85 seems to do the trick.
 

MrChips

Joined Oct 2, 2009
34,828
Don't get hung up on one MCU or even one MCU manufacturer. With a broad selection available in your knowledge toolbox, you can choose the best MCU for the job.
 

be80be

Joined Jul 5, 2008
2,395
Have fun brick a chip the 85 not hard to high voltage program I posted a simple add on 6 resistors and a 2n2222 will be just fine. I use a 12 volt wallwart
All it does is pull reset to 12 volts.
But on a side note you should play with the digspark
The bootloader I don’t think needs the reset pin
And programs serial so the only problem is messing up loading the boot loader
It works even on a breadboard 2 3.6 zener diodes 1. 1.5k and 2 47 to 68 ohm resistors and old usb cord
And don’t forget a 104 cap on the power rails
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
Have fun brick a chip the 85 not hard to high voltage program I posted a simple add on 6 resistors and a 2n2222 will be just fine. I use a 12 volt wallwart
All it does is pull reset to 12 volts.
But on a side note you should play with the digspark
The bootloader I don’t think needs the reset pin
And programs serial so the only problem is messing up loading the boot loader
It works even on a breadboard 2 3.6 zener diodes 1. 1.5k and 2 47 to 68 ohm resistors and old usb cord
And don’t forget a 104 cap on the power rails
ok and thanks for the info :)
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
I also like to say for people using a 12 volt Dc wallwart for the HVP programmer build. It's not a bad idea to add a 1000uf 16 volt electrolytic capacitor across the +12. This cap is a polarized capacitor, meaning it has a + side and a - side to the cap. So make sure the - side of the cap goes to (- side) ground and the + side goes to the +12 side! This cap may not be need for this project, however I notice my wallwart was not clean on the output (it has ripples on the output i checked it with a scope)
 
Top