Digistump Forums

The Digispark => Digispark (Original) Support => Topic started by: d0ctrine on January 04, 2018, 01:01:28 am

Title: Can't upload any code on digispark. Bricked ?
Post by: d0ctrine on January 04, 2018, 01:01:28 am
Hi everyone,

I had setup my arduino IDE to work on Digispark, uploaded the blink code, and the led start blinking, so I think it's all good.

But now I tried to upload another code (the keyboard example given by digistump) :

Code: [Select]
#include "DigiKeyboard.h"

void setup() {
  // don't need to set anything up to use DigiKeyboard
}


void loop() {
  // this is generally not necessary but with some older systems it seems to
  // prevent missing the first character after a delay:
  DigiKeyboard.sendKeyStroke(0);
 
  // Type out this string letter by letter on the computer (assumes US-style
  // keyboard)
  DigiKeyboard.println("Hello Digispark!");
 
  // It's better to use DigiKeyboard.delay() over the regular Arduino delay()
  // if doing keyboard stuff because it keeps talking to the computer to make
  // sure the computer knows the keyboard is alive and connected
  DigiKeyboard.delay(5000);
}

The upload seems good :

Code: [Select]
> Device is found!
connecting: 16% complete
connecting: 22% complete
connecting: 28% complete
connecting: 33% complete
> Device has firmware version 1.6
> Available space for user applications: 6012 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94  page size: 64
> Erase function sleep duration: 752ms
parsing: 50% complete
> Erasing the memory ...
erasing: 55% complete
erasing: 60% complete
erasing: 65% complete
> Starting to upload ...
writing: 70% complete
writing: 75% complete
writing: 80% complete
> Starting the user app ...
running: 100% complete
>> Micronucleus done. Thank you!

But the led keep blinking, and the "Hello world" text is never displayed on my computer. So how can I debug a digispark device ? please.

Thank for any help :)

PS : I bought a new digispark device, and the led blink by default, is that a normal behavior ? Or the led is trying to tell me something ? :)
Title: Re: Can't upload any code on digispark. Bricked ?
Post by: zombymumf on January 16, 2018, 08:28:23 am
Just to add my support to this post. I have exactly the same problem, so if any wise old head can help us both, I would be extremely grateful.
Title: Re: Can't upload any code on digispark. Bricked ?
Post by: dl4ou on January 16, 2018, 01:21:06 pm
131/5000
It looks like Attiny does not write its flash memory. It could be that the extended-fuse is set incorrectly.
You could verify this with an ISP-Programmer.
Title: Re: Can't upload any code on digispark. Bricked ?
Post by: zombymumf on January 17, 2018, 01:30:15 am
OK, so I now have heard about efuses for the first time. Steep learning curve!

The datasheet says that the RSTDISBL bit is 'off' at shipping time. This piece of kit I am using is a virgin board - straight from the anti-static bag, and hasn't been touched by primate hands before.

If it did arrive in a state to disable external reset (a zero) wouldn't the Arduino IDE barf when uploading the sketch? The micronucleus output says that the program did download and work - it just doesn't.
Title: Re: Can't upload any code on digispark. Bricked ?
Post by: PeterF on January 17, 2018, 03:45:14 am
Is that the right fuse setting you're looking it? RSTDISBL is a high fuse! ;) You're looking for the extended fuse setting, specifically the "SELFPRGEN" one. If that isn't on, then micronucleus is unable to actually write your newly uploaded program to the ATTiny85s flash memory.

For 'stock' ATTiny85s RSTDISBL would be off, as you'd never be able to program them without a high voltage programmer. But on the Digispark it should be on, as this lets the reset pin be used as an extra IO pin.

It looks like the stock defaults are out for - the clock is wrong (8Mhz internal instead of PLL), brownout isn't enabled (and brownout voltage set), self-programming is not enabled, external reset is enabled).

These are the fuse settings for digisparks...

Code: [Select]
Low fuse: 0xe1
High fuse: 0x5d
Extended fuse: 0xfe

You can see the difference between stock settings and these if you go onto the Engbedded Atmel AVR Fuse Calculator (http://www.engbedded.com/fusecalc/), pick attiny85 from the dropdown, and look at the defaults. You can put these fuse settings in manually further down the page if you want to see the difference.