Go Down

Topic: ATtiny85 Pin usage (Read 23254 times) previous topic - next topic

ralphd

You can run avrdude from the command line to disable the reset fused after you've programmed the AVR.
Unthinking respect for authority is the greatest enemy of truth - Einstein.

Code: [Select]
avrdude -pattiny85 -cstk500v1 -v -v -v -v -P /dev/tty.usbmodemfa131 -b19200 -U hfuse:w:0x54:m

Great, it worked, thanks





I created a BAT file to run AVRdude:
Code: [Select]
avrdude -P COM4 -b 19200 -c avrisp -p attiny85 -v -e -U lfuse:w:0xE2:m -U hfuse:w:0x5F:m -U efuse:w:0xFF:m  -U flash:w:tm1640.hex

(Using ArduinoISP **from v0023** on my UNO) I ran the bat file, and voila!


The RESET pin now functions as I programmed it to in the Arduino IDE!


This worked for me, but unfortunately also erased the chip, thanks to the inclusion -e switch (my fault for just copying and pasting without understanding). If you want to just disable the reset pin, as I did, then upload the sketch first in the normal way, then run
Code: [Select]
avrdude -P COM4 -b 19200 -c avrisp -p attiny85 -v lfuse:w:0xE2:m -U hfuse:w:0x5F:m -U efuse:w:0xFF:m 


This did the trick for me using an Arduino as an ISP and the ATtiny85 Optiboot core from TCWorld

avrdude -P /dev/tty.usbserial-A800euXT -b 19200 -c Arduino -p attiny85 -v -U lfuse:w:0xE2:m -U hfuse:w:0x5F:m -U efuse:w:0xFE:m

The nice thing is that I am able to use FTDI to upload sketches AND use PB5 as an I/O.

For those interested, install the TCWorld cores from here: https://github.com/TCWORLD/ATTinyCore
I used Arduino as an ISP to burn the "Optiboot ATtiny85 @ 8 MHz (internal osc)" bootloader to the '85
Break out the FTDI adapter! PB0 is the TX and goes to RX of FTDI, PB1 is RX to TX of FTDI, PB2 is LED then connect a 10k resistor between reset and vcc, then a 0.1uF cap between reset and DTR of the FTDI board.
Connect the '85 to a serial terminal at 9600 baud and press x a few times without a line feed to calibrate the internal oscillator, you should see the '85 respond and tell you when to stop. Now you can program the '85 with the Arduino IDE over serial as long as you select the Optiboot ATtiny85 @ 8M

To use PB5 as an I/O, put the '85 back on to the ISP (not FTDI). Then run the avrdude command above. You will most likely have to change the port the ISP is connected to, mine just happened to be /dev/tty.usb-and so forth-. Once you run the command, you should see some terminal output followed by "avrdude done. Thank you"
Now you can upload sketches with the FTDI circuit above, if you get an error mentioning the programmer is not responding, it is because the bootloader delay is too short- the old sketch begins to run as the IDE compiles and attempts to upload a new one. The work around for this is to leave everything wired up, disconnect vcc from the tiny, begin the upload, and quickly power the Tiny back on while the sketch is compiling. It is well worth it for an extra I/O and the ability to load new sketches without an HV programmer.


mrburnette

Quote

The nice thing is that I am able to use FTDI to upload sketches AND use PB5 as an I/O.


An alternative is to reproduce the Digispark which also provides access to a large collection of sketches and supporting libs.
Build a Trinket (clone):
http://www.hackster.io/rayburne/chachka-trinket-attiny85-clone
Trinket to Digispark:
http://www.hackster.io/rayburne/trinket-firmware-exorcism?offset=12&ref=user&ref_id=506


Ray

I build a programmer like described here: http://www.rickety.us/2010/03/arduino-avr-high-voltage-serial-programmer/

just instead of the ports they used I used the ports arduino ISP uses,

now, the sketch there (adapted for other pins) runs and I can change fuses,

but how do I modify the ArduinoISP sketch to be able to upload sketches using HVSP to an Attiny85

An unmodified ArduinoISP did not worked, and i guess its at least due to the leak of the clock pin, the tiny has always VCC power not like in the original circuit, so it may be only an issue of the missing clock.


PS: i tryed also this sketch http://www.lydiard.plus.com/downloads/downloads.htm it should provide a clock and it does something but than the sketch reboots for some reason and averdude throws an error :(

Go Up