I have a digispark that I want to reprogram, soldered into a circuit. I have burned the default t85 micronucleus firmware.
This is the command I used:
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude" -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -pattiny85 -cstk500v1 -PCOM4 -b19200 -Uflash:w:D:\Documents\micronucleus-master\firmware\releases\t85_default.hex:i
avrdude: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM4
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATtiny85
Chip Erase delay : 400000 us
PAGEL : P00
BS2 : P00
RESET disposition : possible i/o
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 12 4 0 no 512 4 0 4000 4500 0xff 0xff
flash 65 6 32 0 yes 8192 64 128 30000 30000 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.03s
avrdude: Device signature = 0x1e930b (probably t85)
avrdude: safemode: hfuse reads as D7
avrdude: safemode: efuse reads as FF
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "D:\Documents\micronucleus-master\firmware\releases\t85_default.hex"
avrdude: writing flash (8116 bytes):
Writing | ################################################## | 100% 0.07s
avrdude: 8116 bytes of flash written
avrdude: verifying flash memory against D:\Documents\micronucleus-master\firmware\releases\t85_default.hex:
avrdude: load data flash data from input file D:\Documents\micronucleus-master\firmware\releases\t85_default.hex:
avrdude: input file D:\Documents\micronucleus-master\firmware\releases\t85_default.hex contains 8116 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.07s
avrdude: verifying ...
avrdude: 8116 bytes of flash verified
avrdude: safemode: hfuse reads as D7
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (E:FF, H:D7, L:F1)
avrdude done. Thank you.
I have not set any fuses (I hope the frequency is right.)
The board is recognized by my computer and I can program a sketch into it using Arduino IDE. Despite all this the program I burned into it does not run. It seems it is stuck into the bootloader section.
The sketch:
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(0, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(0, HIGH);
}
Pin PB0
has never a voltage bigger than 1.7V
(noise or floating). All pins have similar voltages (except PB3
,PB4
which are pulled up or high)
The circuit works. I tested both displays previously with the atiny which I directly programmed with the Uno
. The upper right connector is directly plugged into the digispark
with the following pins: VIN
,GND
,5V
. The middle connector is also plugged into the digispark
.
I have tried:
- Powered by USB: I am afraid this will be detected by the bootloader and enter the programming state thus never running the schematic(shouldn't happen but you never know...)
- Powered by VIN with a 9V battery. Nothing. All voltages are in check (
5V pin
has5v
on it. All other pins are floating) - Powered by
5V pin
using anArduino UNO
as the source. Nothing. In all cases the voltage on PB0 stays the same. It varies between0.6V
and1.6V
.
In Arduino IDE:
- Tried Digispark 16.5Mhz
- Digispark Pro 16Mhz
- Digispark(No Usb) 16Mhz
Always a succesfull uploading.
Notes:
After uploading in Arduino this text comes up:
Starting the user app ... running: 100% complete
So it is supposed to run the program but the board actually resets because it gets renumerated by windows.
It's not quite possible to de-solder it and program the sketch directly with
Arduino
asISP
- I use Windows 10
- Fuses used when I burned the
micronucleus
L:F1
H:D7
E:FF
. These are the default "safe" values. The actual fuses needed by the firmware areL:E1
H:DD
E:FE
. - Difference in extended fuse: Self-programming is curently disabled...Is this the culprit?
- I managed to desolder
PB0
,PB1
andPB2
from the back of the pcb. Now I can't program it directly withArduino as ISP
. The setup I have should work because I can easily program an t45. So it has something to do with the digispark. Checked the connection between pins and the actual MCU. The error I get isYikes...
and sometimes it finds an 0x00ff00 or other junk id for the board but probably it's because of misconnection.
Question #2:
In the current configuration(soldered) would it be possible to use again Arduino as ISP
to program it? PB0
,PB1
,PB2
are connected to Serial Clock
,Serial Data
and Serial Storage Clock
respectively. I am trying right now to set the right fuses but every time I get this:
avrdude -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -c stk500v1 -p attiny85 -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m -B 20 -b19200 -P COM7
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
make: *** [fuse] Error 1