fork micronucleus 仓库中的固件/digispark 部分
Micronucleus is a bootloader designed for AVR ATtiny microcontrollers with a minimal usb interface, cross platform libusb-based program upload tool, and a strong emphasis on bootloader compactness. To the authors knowledge this is, by far, the smallest USB bootloader for AVR ATtiny.
The V2.0 release is a complete rewrite of the firmware and offers significant improvements over V1.x.
Due to the many changes, also the upload tool had to be updated. The V2.0 upload tool is backwards compatible to the V1.X tool, though.
The bootloader allows uploading of new firmware via USB. In its usual configuration it is invoked at device power or on reset and will identify to the host computer. If no communication is initiated by the host machine within a given time (default are 6 seconds), the bootloader will time out and enter the user program, if one is present.
For proper timing, the command line tool should to be started on the host computer before the bootloader is invoked / the board attached.
The bootloader resides in the same memory as the user program, since the ATtiny series does not support a protected bootloader section. Therefore, special care has to be taken not to overwrite the bootloader if the user program uses the self programming features. The bootloader will patch itself into the reset vector of the user program. No other interrupt vectors are changed.
Please invoke the command line tool with "micronucleus --help" for a list of available options.
If the Digispark board is not recognized by Microsoft Windows you must install the appropriate driver.
For Windows you must install the libusb driver before you can program the board. Download it here, open it and run InstallDrivers.exe.
Clean Micronucleus devices without uploaded user program will not time out and allow sufficient time for proper driver installation. Linux and OS X do not require custom drivers.
The new ATTinyCore by Spence Konde shrinks generated code size by 5 to 15 percent. Just replace the old Digispark board manager URL http://digistump.com/package_digistump_index.json (e.g.in Arduino File > Preferences) by the new http://drazzy.com/package_drazzy.com_index.json and install the latest version.
To update your old, flash consuming bootloader, you have 2 choices.
Use the new Digistump board manager URL (see above), choose a bootloader with Tools > Micronucleus variant and then burn it with Tools > Burn Bootloader.
Run one of the Windows scripts like e.g. the 1_Upgrade-t85_default.cmd. The internal mechanism is described here.
The meaning of fuses can be seen with the Engbedded Atmel AVR Fuse Calculator.
Windows helper scripts for setting fuses can be found here.
The default fuses for a Digispark board are:
System Clock Prescaler register.BOD enabled requires additional 20 µA in sleep state and therefore may be not desirable for low power battery applications. To disable BOD, use 0xDF as Hfuse.
The default fuses for a Digispark Pro board are:
This can only be done by means of a High Voltage programmer.
Try another Cable, try another USB-Port, try another Board, try another Bootloader-variant, try another Computer, try another OS.
In this order.
If not otherwise noted, the OSCCAL value is calibrated (+/- 1%) after boot for all ATtiny85 configurations | Configuration | Free FLASH | Boot-
loader size | Non default config flags set | |-|-|-|-| | t85_agressive
It works for my Digispark boards without any problems :-) | 6778 | 1362 | Do not provide calibrated OSCCAL, if no USB attached, ENABLE_UNSAFE_OPTIMIZATIONS Relying on calibrated 16MHz internal clock stability, not using the 16.5 MHz USB driver version with integrated PLL. This causes the main memory saving. | | | | | | | t85_default | 6650 | 1514 | - | | t85_entry_on_powerOn | 6586 | 1550 | ENTRY_POWER_ON, LED_MODE=ACTIVE_HIGH | | t85_entry_on_powerOn_ fastExit | 6586 | 1572 | ENTRY_POWER_ON, FAST_EXIT_NO_USB_MS=300, LED_MODE=ACTIVE_HIGH | | t85_entry_on_powerOn_ activePullup_fastExit recommended configuration | 6586 | 1576 | ENTRY_D_MINUS_PULLUP_ACTIVATED_AND_ENTRY_POWER_ON, FAST_EXIT_NO_USB_MS=300, LED_MODE=ACTIVE_HIGH | | t85_entry_on_powerOn_ activePullup_fastExit_noLED| 6586 | 1558 | ENTRY_D_MINUS_PULLUP_ACTIVATED_AND_ENTRY_POWER_ON, FAST_EXIT_NO_USB_MS=300 | | t85_entry_on_powerOn_ pullupAt0 | 6650 | 1538 | ENTRY_POWER_ON, USB_CFG_PULLUP_IOPORTNAME + USB_CFG_PULLUP_BIT | | t85_entry_on_reset_ activePullup_fastExit | 6586 | 1576 | ENTRY_D_MINUS_PULLUP_ACTIVATED_AND_ENTRY_EXT_RESET, FAST_EXIT_NO_USB_MS=300, AUTO_EXIT_MS=15000 Bootloader timeout increased to 15 seconds (if connected to USB), LED_MODE=ACTIVE_HIGH. | | t85_fastExit | 6586 | 1554 | FAST_EXIT_NO_USB_MS=300, LED_MODE=ACTIVE_HIGH | | | | | | | t88_default | 6778 | 1350 | LED_MODE=ACTIVE_HIGH For 16 MHz quartz | | t88_entry_on_powerOn_ activePullup_fastExit recommended configuration | 6778 | 1394 | ENTRY_D_MINUS_PULLUP_ACTIVATED_AND_ENTRY_POWER_ON, FAST_EXIT_NO_USB_MS=300, LED_MODE=ACTIVE_HIGH For 16 MHz quartz | | | | | | | t167_default | 14970 | 1342 | - | | t167_entry_on_powerOn_ activePullup_fastExit recommended configuration | 14970 | 1406 | ENTRY_D_MINUS_PULLUP_ACTIVATED_AND_ENTRY_POWER_ON, FAST_EXIT_NO_USB_MS=300, LED_MODE=ACTIVE_HIGH For 16 MHz quartz | | t167_entry_on_reset_ activePullup_fastExit | 14970 | 1406 | ENTRY_D_MINUS_PULLUP_ACTIVATED_AND_ENTRY_EXT_RESET, FAST_EXIT_NO_USB_MS=300, AUTO_EXIT_MS=15000 Bootloader timeout increased to 15 seconds (if connected to USB), LED_MODE=ACTIVE_HIGH. For 16 MHz quartz | | | | | | | t45_default | 2554 | 1514 | | | t4313_default | 6714 | 1460 | | | Nanite841 | 6586 | 1548 | | | t841_default | 6650 | 1514 | | | t84_default | 6650 | 1480 | | | | | | | | m168p_extclock | | 1498 | | | m328p_extclock | | 1498 | |
FAST_EXIT_NO_USB_MS for fast bootloader exitIf the bootloader is entered, it requires minimum 300 ms to initialize USB connection (disconnect and reconnect). 100 ms after this 300 ms initialization, the bootloader receives a reset.
The 100 ms time to reset may depend on the type of host CPU etc., so I took 200 ms to be safe to detect a reset.
This configuration waits for 200 ms after initialization for a reset and if no reset detected it exits the bootloader and starts the user program.
With this configuration the user program is started with a 500 ms delay after power up or reset if no USB is attached, even if we do not specify a special entry condition.
IF USB is attached, we wait another 1200 ms (to cover slow hosts, otherwise 500 would be OK) after the reset for the host upload program (micronucleus.exe) to request the configuration information. If no upload program is detected, we start the user program.
ENTRY_POWER_ON entry conditionThe ENTRY_POWER_ON configuration adds 18 bytes to the ATtiny85 default configuration.
The content of the MCUSR is copied to the GPIOR0 register to enable the user program to evaluate it and then cleared to prepare for next boot.
In this configuration a reset will immediately start your user program without any delay.
ENTRY_EXT_RESET entry conditionThe ATtiny85 has the bug, that it sets the External Reset Flag also on power up. To guarantee a correct behavior for ENTRY_EXT_RESET condition, it is checked if only this flag is set and MCUSR is cleared before start of user program. The latter is done to avoid bricking the device by fogetting to reset the PORF flag in the user program.
For ATt
暂无开放 Issues,或尚未同步最近议题。