Author Topic: Is there any way to remove the 5 seconds programming delay at powerup ?  (Read 101916 times)

granzeier

  • Jr. Member
  • **
  • Posts: 73
Re: Is there any way to remove the 5 seconds programming delay at powerup ?
« Reply #60 on: September 15, 2019, 03:08:07 am »
I (and possibly most others here) do not have, nor know much about, the Digispark Pro. You will probably get better help if you go to the Pro Support board (http://digistump.com/board/index.php/board,19.0.html,) rather than this board for the Original.

velodrom

  • Newbie
  • *
  • Posts: 1
Re: Is there any way to remove the 5 seconds programming delay at powerup ?
« Reply #61 on: October 12, 2019, 01:48:30 pm »
Hi. I'm having challenges changing the default bootloader activation pin from PB0. Any help would be appreciated, thanks!

I'm working with a Digispark Attiny85 board. After several attempts I was finally able to get rid of the 5 second bootloader wait (steps how I did this are listed below). I even later managed to enter bootloader by shorting PB0 to ground, and upload new applications with Arduino IDE (hooray). However, what does not seem to work is changing the bootloader activation pin (PB0). I need PB0 (and PB2) for I2C purposes in my project, so I would rather use PB1 or PB4 to enter bootloader. What I've done to change the pin is
  • clone micronucleus repo (https://github.com/micronucleus/micronucleus.git)
  • modify firmware/configuration/t85_default/bootloaderconfig.h as illustrated in a code snippet below
  • compile new bootloader .hex file using make clean; make CONFIG=t85_default
  • use an Arduino Uno as an ISP programmer to connect to the Digispark Attiny85
  • use avrdude to change fuse settings and flash the new .hex file (this turned out to be a great guide). If someone is reading this to repeat it, avrdude is located under your Arduino install path which defaults to: Program Files (x86)\Arduino\hardware\tools\avr\bin.
  • upload a project to the board using Arduino IDE, meaning disconnecting the board from Arduino Uno and plugging it in to a USB port
  • repeat step 6. with the jumper to verify I still have access to bootloader
The avrdude command that worked for me was:
Code: [Select]
avrdude.exe -c stk500v1 -p attiny85 -P com5 -U flash:w:..\t85_default.hex -U lfuse:w:0xf1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m -v -C ..\etc\avrdude.conf -b 19200
My diff to bootloaderconfig.h:
Code: [Select]
diff --git a/firmware/configuration/t85_default/bootloaderconfig.h b/firmware/configuration/t85_default/bootloaderconfig.h
index 9b3ac63..6de518f 100644
--- a/firmware/configuration/t85_default/bootloaderconfig.h
+++ b/firmware/configuration/t85_default/bootloaderconfig.h
@@ -107,9 +107,9 @@
  *
  */

-#define ENTRYMODE ENTRY_ALWAYS
+#define ENTRYMODE ENTRY_JUMPER

-#define JUMPER_PIN    PB0
+#define JUMPER_PIN    PB1
 #define JUMPER_PORT   PORTB
 #define JUMPER_DDR    DDRB
 #define JUMPER_INP    PINB

I'm wondering do I need to change eg. JUMPER_INP to something else if I want to use PB1 as the entry pin? Why I'm saying this is that the bootloaderconfig.h seems to define a bootLoaderStartCondition() function like so:
Code: [Select]
#define bootLoaderStartCondition() (!(JUMPER_INP&_BV(JUMPER_PIN)))

Thanks already in advance for your help!
« Last Edit: October 12, 2019, 01:58:06 pm by velodrom »

rubberduck

  • Newbie
  • *
  • Posts: 5
Re: Is there any way to remove the 5 seconds programming delay at powerup ?
« Reply #62 on: October 31, 2019, 08:07:43 am »
My bunch of 5 'rev 3' clones had the P5 NOT redefined as useable pin so that a normal ISP Programmer will work on them. P5 = reset here.

SilentWarrior

  • Newbie
  • *
  • Posts: 1
Re: Is there any way to remove the 5 seconds programming delay at powerup ?
« Reply #63 on: January 05, 2020, 03:06:50 pm »
Anyone finding this in the future looking for a way to remove the startup delay on their Digistump Attiny85 (or other) here are the instructions:

- Go here: https://github.com/micronucleus/micronucleus/tree/v1.11
- Download the whole project on 1.11 (thats the tag where the needed .hex files are at this point in time) and extract it to a dir.
- On Windows, open the command line and drag the file "micronucleus-1.11\commandline\builds\Windows\micronucleus.exe" to the command line so it pastes the whole path in it
- Click on the command line window, put a space in front of the path and add "--run" and another space
- Drag the "micronucleus-1.11\upgrade\releases" file you want to burn to your device, in my case, I use the PB0 as a push button (the only one) for my project, so I am just going to re-use it, so I picked the "micronucleus-1.11-entry-jumper-pb0-upgrade.hex"
- Once you drag you should see the full path of the exe + " --run " + the full path of the hex file
- Make sure the device is disconnected.
- Press enter and it will ask you to connect your device, it will then burn the new bootloader.
- Now when you want to program your device just keep the push button (PB0 in my case) pressed while you plug in the USB.

Note: There is two directories with .hex files, one is for FULL bootloaders (this will fail because of not enough space since there is a bootloader already on the device) and an UPGRADE dir. In the example I used the UPGRADE dir since my device came with a bootloader.

Example output :

Code: [Select]
C:\Users\silent>C:\Users\silent\Downloads\micronucleus-1.11\micronucleus-1.11\commandline\builds\Windows\micronucleus.exe --run C:\Users\silent\Downloads\micronucleus-1.11\micronucleus-1.11\upgrade\releases\micronucleus-1.11-entry-jumper-pb0-upgrade.hex
> Please plug in the device ...
> Press CTRL+C to terminate the program.
> Device is found!
connecting: 16% complete
connecting: 19% complete
connecting: 22% complete
connecting: 25% 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: 33% complete
parsing: 50% complete
parsing: 50% complete
> Erasing the memory ...
erasing: 50% complete
erasing: 50% complete

....

erasing: 66% complete
erasing: 66% complete
> Starting to upload ...
writing: 66% complete
writing: 66% complete
writing: 67% complete

.....

writing: 83% complete
writing: 83% complete
> Starting the user app ...
running: 83% complete
running: 100% complete
>> Micronucleus done. Thank you!

C:\Users\silent>