DigiSpark with 6 input/output pins, homebrew fuse-programmer

Arduino projects on the go
Mike_K
Posts: 224
Joined: 16 Feb 2018, 06:35

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by Mike_K » 19 Apr 2019, 11:58

Hi Phil

From your description, the problem manifests itself when the "RESET" is configured as an input (for the elevon link) and not an output (blink).

Late last night I tried my AVR HV programmer and set the fuses so that PB5 is an I/O (not RESET), set it for input with pull-up enabled and it behaves as it should do. So an ATtiny85 (on a breadboard in my case, not a Digispark board) can be configured as an input. it must be something your programmer is doing wrong or is there any other components on the board that could be interfering?

Right back to flying - I'm just taking a break while some larger models were flying.

Mike

User avatar
Phil_G
Posts: 256
Joined: 15 Feb 2018, 23:32
Contact:

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by Phil_G » 19 Apr 2019, 14:45

This pic suggests that the decoupling caps on the DigiSpark slow the 5v rise-time considerably.
I think the next step is to add say 50uS to the delay between applying vcc and 12v.
If I get time later today I'll try it:

Image

void vcc_on() {
// Enter High-voltage Serial programming mode
digitalWrite(VCC, HIGH); // Apply VCC to start programming process
delayMicroseconds(20); // TRY 50-70uS HERE ???
digitalWrite(RST, LOW); //Turn on 12v
delayMicroseconds(10);
pinMode(DATAIN, INPUT); //Release DATAIN
delayMicroseconds(300);
}

Another version (there are many, all very similar) suggests that an active 12v via a PNP to pos is more reliable than the current 1k pullup to 12v, I will try that too, though that will take a bit longer.
I've since checked out several of these very similar fuse-blower projects, and they all mention weirdness and fuse miss-reads!

User avatar
Phil_G
Posts: 256
Joined: 15 Feb 2018, 23:32
Contact:

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by Phil_G » 19 Apr 2019, 15:15

Eureka!!!

Thats it chaps. By allowing a bit more 'setting time' before turning on the 12v programming voltage,
all my 'suspect' DigiSparks program perfectly. That includes the 'bink_p5' ones and a couple of '2+1 encoder' ones. I will upload the amended sketch to post #1.

EDIT: Yep that appears to be it. I have 22 DigiSparks here on my bench, some new ones that I've just unpacked, some I've loaded with either 'blink_p5' or the 2+1 encoder, and some with random project sketches on them.

ALL now behave perfectly. The P5 switch to enable the elevon mixer on the 2+1 works fine. They all load blinky ok, and after setting P5 to I/O they all blink P5 ok. After setting P5 back to 'reset' they all reprogram ok.

I'm quite relieved after everyone had hoped to join in the fun and had no success. Please try the amended sketch & let us know how it goes, I hope you'll find its fine now Image

Not sure if I made the operation clear - it reads the fuses, waits 10 seconds, writes 'P5=reset', waits 10 seconds, writes 'P5=I/O' then halts. Just unplug when the DigiSpark is showing the fuse-state you need.

Cheers
Phil

User avatar
tiptipflyer
Posts: 190
Joined: 16 Feb 2018, 22:49
Location: Germany

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by tiptipflyer » 19 Apr 2019, 15:35

Another Eureka from here,

thank you very much Phil, your help is highly appreciated.

Now all three versions of the Digispark work as supposed to. The display changes from DF to 5F as it should and all versions work as expected.
I tried a bigger sketch for a S/C transmitter with separate throttle button, low voltage alert, motor LED etc, no problems.
Also tried a sketch for a two channel proportional transmitter with low voltage alert, inactivity buzzer, S/C button, servo reverse, etc, also no problems.

Cheers
Frank
Last edited by tiptipflyer on 06 May 2019, 08:20, edited 2 times in total.

Martin
Posts: 252
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by Martin » 19 Apr 2019, 20:24

Mine's also working with a longer delay. Thanks.

By the way, I recommend putting something like this right at the start of your setup() function. That way, you get something on the display even if no DigiSpark is present or for some reason not responding - it gives you some confidence that at least the sketch is running, and the display working.

Code: Select all

void setup() {
  // Display something to prove that the OLED is working
  u8g.firstPage();
  do {
    u8g.setFont(u8g_font_6x10);
    u8g.drawStr( 0, 20,  "  Phil_G's ATtiny85");
    u8g.drawStr( 0, 40,  "   Fuse programmer");
  } while ( u8g.nextPage() );
  
  // Set up control lines for HV parallel programming
  pinMode(VCC, OUTPUT);
  pinMode(RST, OUTPUT);
  pinMode(DATAOUT, OUTPUT);
  pinMode(INSTOUT, OUTPUT);
  pinMode(CLKOUT, OUTPUT);
  pinMode(DATAIN, OUTPUT);  // configured as input when in programming mode
  
Everything before the setup() function after the while(); statement 7 lines into the setup() function is unmodified.

User avatar
Phil_G
Posts: 256
Joined: 15 Feb 2018, 23:32
Contact:

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by Phil_G » 19 Apr 2019, 22:21

Thanks lads, relieved to hear they're all working now Image

Thanks both for your perseverance, for anyone else fancying a go - and it is a really useful tool if you like DigiSparks - the sketch in the opening post is updated with the timing mod and a variation of Martin's 'intro' suggestion (go on, try it!) :D

Cheers
Phil

User avatar
tiptipflyer
Posts: 190
Joined: 16 Feb 2018, 22:49
Location: Germany

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by tiptipflyer » 20 Apr 2019, 16:33

Hi Phil,
this morning, with the help of this great tool, I added another function to my Citizenship replica transmitter.
It now has a motor LED on P5 in addition to the other features.
So it is the first time I tried a real transmitter with a fully loaded Digispark:
P0=PPM, P1=S/C button, P2=buzzer, P3=throttle button, P4=voltage alert, P5=motor LED.
Works great. Thank you Phil for another great project.
CitizenShip7.JPG
Cheers
Frank

User avatar
Phil_G
Posts: 256
Joined: 15 Feb 2018, 23:32
Contact:

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by Phil_G » 25 Apr 2019, 23:50

I've added a better opening screen, update is in post #1 :D


IMG_5245[1].JPG


Heres the battery holder and 12v battery I used, from Component Shop:

A23 12v Battery
Battery holder

The battery box is permanently wired through a momentary push-to-make button, so no on-off switch is needed. I've been using quite a few DigiSparks lately and the fuse programmer has really been earning its keep Image

Cheers
Phil
Attachments
IMG_20190425_235939_361.JPG
IMG_20190426_000149_599.JPG

User avatar
tiptipflyer
Posts: 190
Joined: 16 Feb 2018, 22:49
Location: Germany

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by tiptipflyer » 16 May 2019, 16:59

I did a 3D-printed case for the fuse programmer.
I am still waiting for the battery holder from China.
It is working great now, no problems anymore.
Thanks Phil.
SAM_3768.JPG
Cheers
Frank

User avatar
Phil_G
Posts: 256
Joined: 15 Feb 2018, 23:32
Contact:

Re: DigiSpark with 6 input/output pins, homebrew fuse-programmer

Post by Phil_G » 16 May 2019, 19:54

Hows your 12v battery lasting Frank?
Mine is flat already, its down to 9v on load after only a couple of weeks use!
I'm surprised as its a genuine Duracell, I expected it to last forever :D
The battery has got too low to put the DigiSpark in HV programming mode so I've had to go back to the 3S lipo!
Cheers
Phil

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests