Aus SatriaWiki
Wechseln zu: Navigation, Suche
(Bootloader upload via ISP)
K (Bootloader upload via ISP)
 
Zeile 14: Zeile 14:
 
Vorgehensweise beim DigisparkPro:
 
Vorgehensweise beim DigisparkPro:
 
[[Datei:ArduinoISP_to_DigisparkPro.png|thumb|right]]
 
[[Datei:ArduinoISP_to_DigisparkPro.png|thumb|right]]
# Arduino und Digispark verkabeln (s. Bild rechts)<br>MOSI (11) -> Pin10 (Pro) | P0<br>MISO (12) -> Pin8 (Pro) | P1<br>SCK (13) -> Pin11 (Pro) | P2<br>RST -> RST (Pro) | P5<br>5V -> 5V<br>GND -> GND
+
# Arduino und Digispark verkabeln (s. Bild rechts)<br>MOSI (11) -> Pin10 (Pro) | P0<br>MISO (12) -> Pin8 (Pro) | P1<br>SCK (13) -> Pin11 (Pro) | P2<br>RST (10) -> RST (Pro) | P5<br>5V -> 5V<br>GND -> GND
 
# ISP Sketch im IDE laden (Beispiele -> ArduinoISP)
 
# ISP Sketch im IDE laden (Beispiele -> ArduinoISP)
 
# USE_OLD_STYLE_WIRING aktivieren
 
# USE_OLD_STYLE_WIRING aktivieren

Aktuelle Version vom 23. Juni 2020, 17:13 Uhr

Bootloader updaten

https://frottier.wordpress.com/2017/11/12/kein-frust-mit-digispark-clones/

Bootloader upload via ISP

Ist der Bootloader eines Digisparks defekt (z.B. durch ein fehlerhaftes Update), kann man mit einem Arduino UNO einen Bootloader auf den ATtiny85 oder ATtiny167 flashen.

Benötigte Dinge:

  • Arduino UNO
  • avrdude.exe (mit einer config.conf, die einen Eintrag für den ATtiny167 enthält.
  • Arduino IDE > 1.6.5
  • COM Port des Arduino auf 19200 baud.
  • Ein .hex file des passenden Bootloaders.

Vorgehensweise beim DigisparkPro:

ArduinoISP to DigisparkPro.png
  1. Arduino und Digispark verkabeln (s. Bild rechts)
    MOSI (11) -> Pin10 (Pro) | P0
    MISO (12) -> Pin8 (Pro) | P1
    SCK (13) -> Pin11 (Pro) | P2
    RST (10) -> RST (Pro) | P5
    5V -> 5V
    GND -> GND
  2. ISP Sketch im IDE laden (Beispiele -> ArduinoISP)
  3. USE_OLD_STYLE_WIRING aktivieren
  4. Sketch auf den Arduino UNO laden. Startet danach automatisch.
  5. avrdude Kommando ausführen (x = COM-Port Nummer):
avrdude -pt167 -carduino -PCOMx -b19200 -Uflash:w:t167_default.hex:i

Der Output sollte in etwa dieser sein:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9487
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 "t167_default.hex"
avrdude: writing flash (16260 bytes):

Writing | ################################################## | 100% 0.26s

avrdude: 16260 bytes of flash written
avrdude: verifying flash memory against t167_default.hex:
avrdude: load data flash data from input file t167_default.hex:
avrdude: input file t167_default.hex contains 16260 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.35s

avrdude: verifying ...
avrdude: 16260 bytes of flash verified

avrdude: safemode: Fuses OK (H:FE, E:DD, L:DF)

avrdude done.  Thank you.


Quelle: https://digistump.com/wiki/digispark/tutorials/proisp

Code snippets

Change clock speed

  1. define CLOCK_SPEED_16MHZ 0
  2. define CLOCK_SPEED_8MHZ 1
  3. define CLOCK_SPEED_4MHZ 2
  4. define CLOCK_SPEED_2MHZ 3
  5. define CLOCK_SPEED_1MHZ 4
  6. define CLOCK_SPEED_500KHZ 5
  7. define CLOCK_SPEED_250KHZ 6
  8. define CLOCK_SPEED_125KHZ 7

volatile void setClockSpeed(byte speed)
{
  CLKPR = 0b10000000; // enable clock change
  CLKPR = speed;
}

void setup()
{
  setClockSpeed(CLOCK_SPEED_8MHZ);
}