Hallo Leute,
ich nutze einen UNO als Arduino as ISP und programmiere andere 328P auf nem Breadboard (mit 8MHz Quarz und 2x 10pF caps).
Bootloader mit selbst erstelltem Board in bords.txt ohne Probleme:
uno.name=Arduino_Joe Customs
uno.upload.tool=avrdude
uno.upload.protocol=arduino
uno.bootloader.tool=avrdude
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.board=AVR_UNO
uno.build.core=arduino
uno.build.variant=standard
## JOE 1b
## -------------------------
uno.menu.cpu.joe1b=JOE1b_8MHzQ65ms BOD2,7V
uno.menu.cpu.joe1b.upload.maximum_size=30720
uno.menu.cpu.joe1b.upload.maximum_data_size=2048
uno.menu.cpu.joe1b.upload.speed=115200
uno.menu.cpu.joe1b.build.f_cpu=8000000L
uno.menu.cpu.joe1b.bootloader.low_fuses=0xFD
uno.menu.cpu.joe1b.bootloader.high_fuses=0xD8
uno.menu.cpu.joe1b.bootloader.extended_fuses=0xFC
uno.menu.cpu.joe1b.bootloader.file=optiboot/optiboot_atmega328.hex
uno.menu.cpu.joe1b.build.mcu=atmega328p
Brennen des Bootloaders i.O:
Auch der ERSTE Hochladen eines (beliebigen) Codes (Blink) nach dem Brennen des Bootloaders ist i.O. und das Programm läuft i.O.:
Der Sketch verwendet 2.816 Bytes (9%) des Programmspeicherplatzes. Das Maximum sind 30.720 Bytes.
Globale Variablen verwenden 186 Bytes (9%) des dynamischen Speichers, 1.862 Bytes für lokale Variablen verbleiben. Das Maximum sind 2.048 Bytes.
/home/jose/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8/bin/avrdude -C/home/jose/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino_build_94853/myBlink_V1.ino.hex:i
avrdude: Version 6.3, compiled on Dec 16 2016 at 12:32:01
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/jose/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8/etc/avrdude.conf"
User configuration file is "/home/jose/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyACM0
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "/tmp/arduino_build_94853/myBlink_V1.ino.hex"
avrdude: writing flash (2816 bytes):
Writing | ################################################## | 100% 3.60s
avrdude: 2816 bytes of flash written
avrdude: verifying flash memory against /tmp/arduino_build_94853/myBlink_V1.ino.hex:
avrdude: load data flash data from input file /tmp/arduino_build_94853/myBlink_V1.ino.hex:
avrdude: input file /tmp/arduino_build_94853/myBlink_V1.ino.hex contains 2816 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 2.70s
avrdude: verifying ...
avrdude: 2816 bytes of flash verified
avrdude done. Thank you.
ABER der ZWEITE und weietre Hochladen sogar des selben Codes Endet mit Fehler verification error:
ABER der ZWEITE und weietre Hochladen sogar des selben Codes Endet mit Fehler verification error:
Der Sketch verwendet 2.816 Bytes (9%) des Programmspeicherplatzes. Das Maximum sind 30.720 Bytes.
Globale Variablen verwenden 186 Bytes (9%) des dynamischen Speichers, 1.862 Bytes für lokale Variablen verbleiben. Das Maximum sind 2.048 Bytes.
/home/jose/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8/bin/avrdude -C/home/jose/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino_build_94853/myBlink_V1.ino.hex:i
avrdude: Version 6.3, compiled on Dec 16 2016 at 12:32:01
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/jose/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8/etc/avrdude.conf"
User configuration file is "/home/jose/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyACM0
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "/tmp/arduino_build_94853/myBlink_V1.ino.hex"
avrdude: writing flash (2816 bytes):
Writing | ################################################## | 100% 3.60s
avrdude: 2816 bytes of flash written
avrdude: verifying flash memory against /tmp/arduino_build_94853/myBlink_V1.ino.hex:
avrdude: load data flash data from input file /tmp/arduino_build_94853/myBlink_V1.ino.hex:
avrdude: input file /tmp/arduino_build_94853/myBlink_V1.ino.hex contains 2816 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 2.70s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0133
0x30 != 0x32
avrdude: verification error; content mismatch
avrdude done. Thank you.
Der ausgewählte serielle Port
ist nicht vorhanden oder das Board ist nicht angeschlossen
:o Hat da Jemand eine Idee, was da schief laufen könnte und wie ich es beheben kann? 
Was ist das für ein Bootloader den du hochlädst ?
Bei einem Atmega328P hat der Flash-Speicher bei mir anschließend noch 32.256 Bytes frei!
Wenn du per ISP flashst, benötigst du den Bootloader nicht.
Optiboot 4.4
aber eigentlich bräuchte ich ihn (erstmal) nicht - für später dann wieder wäre gut
/**********************************************************/
/* Optiboot bootloader for Arduino */
/* */
/* http://optiboot.googlecode.com */
/* */
/* Arduino-maintained version : See README.TXT */
/* http://code.google.com/p/arduino/ */
/* */
/* Heavily optimised bootloader that is faster and */
/* smaller than the Arduino standard bootloader */
/* */
/********************************************/
...
/**********************************************************/
/* Edit History: */
/* */
/* 4.4 WestfW: add initialization of address to keep */
/* the compiler happy. Change SC'ed targets. */
/* Return the SW version via READ PARAM */
/* 4.3 WestfW: catch framing errors in getch(), so that */
/* AVRISP works without HW kludges. */
/* http://code.google.com/p/arduino/issues/detail?id=368n*/
/* 4.2 WestfW: reduce code size, fix timeouts, change */
/* verifySpace to use WDT instead of appstart */
/* 4.1 WestfW: put version number in binary. */
/**********************************************************/
#define OPTIBOOT_MAJVER 4
#define OPTIBOOT_MINVER 4
Mit dem habe ich das bisher nie gemacht.
Was, wenn du den Bootloader nimmst, der normal bei der IDE mitgeliefert wird ?
Damit funktioniert es bei mir immer.
Mal so zum Verständnis/Anmerkungen:
-
auch wenn ich den Code mit "Arduino as ISP" hoch lade, kann doch ein Bootloader auf dem Ziehl-Uno drauf sein, oder?
-
Es hat scheinbar keinen Einfluss, ob ich unter Werkzeug/Programmer "Arduino as ISP" auswähle oder "AVR ISP"
HotSystems:
Mit dem habe ich das bisher nie gemacht.
Was, wenn du den Bootloader nimmst, der normal bei der IDE mitgeliefert wird ?
Damit funktioniert es bei mir immer.
Gute Idee, aber das ist der.. ich habe mir nur in der boards.txt zusätzlich einpaareigene Boardsdefiniert und vom UNO copy-paste gemacht. Da steht bei mir der "...bootloader.file=optiboot/optiboot_atmega328.hex"
Welcher ist also der "normale" bzw wo her nehmen?
avrdude: verification error, first mismatch at byte 0x0133
0x30 != 0x32
Tritt denn der "Verification Error" immer an dieser Stelle auf?
Oder passieren die unterschiedlichsten Sachen?
Ich hatte mal eine schlechte Verkabelung zwischen Programmiergerät und atmega328, oder einen anderen unidentifizierten Fluchgenerator. Jedenfalls liessen sich kleinere Sketche mit höherer Wahrscheinlichkeit laden als größere war meine Beobachtung...
michael_x:
Tritt denn der "Verification Error" immer an dieser Stelle auf?
Gute Idee, ich beobachte das mal. Als Code verwende ich immer einen leicht modifizierten Blink Sketch (blinkt x mal in for loop um zuerkennen ob der neu hochbeladene oder alte Code im uC läuft). Hab aber auch schon andren Code getestet mit der exakt selben beobachtung: das 1. mal nach Bootloader Brennen ist immer OK, danach geht mit ISP nix mehr. Auch nicht nach 5x versuchen.
Denke das ist kein Zufälliger Fehler, sondern mit System und mit "Grund" im Sinne von Irgendwas läuft beim 1. Code hochladen anders als beim 2. Mal. 
PS: via Bootloader und mit 16MHZ Quarz lässt sich immerhin beliebig neuer Code hoch laden, immerhin 
PPS: Mit 8MHz Quarz (und entspr. geänderten Fuses) kann ich leider kein Code via Bootloader hoch laden - was ist da los?? Was läuft da falsch??
HotSystems:
Bei einem Atmega328P hat der Flash-Speicher bei mir anschließend noch 32.256 Bytes frei!
Gut beobachtet... in meiner board.txt stand da
.upload.maximum_size=30720
.upload.maximum_data_size=2048
vielleicht ist das der Fehler. nur was sollte da stehen? ist das 1. der Flash und das 2 (data) derBootloader?
Also ich habe mal auf 32256b in boards.txt geschrieben:
uno.menu.cpu.joe1b.upload.maximum_size=32256
Fehlerbild bleibt leider gleich: (Fehlerstelle auch, wenn ich nix am Code ändere, wenn ich z.B. eine Schleifenvar. ändere ändert sich die Fehlerstelle leicht:
avrdude: verification error, first mismatch at byte 0x0136
0x30 != 0x31
vrdude: verification error, first mismatch at byte 0x0134
0x30 != 0x34
avrdude: verification error, first mismatch at byte 0x0134
0x30 != 0x36
Nein, jetzt auch beim Seriellen Hochladen via Bootloader und an anderer Stelle, aber nur 1x (nicht reproduzierbar):
avrdude: verification error, first mismatch at byte 0x066c
0x91 != 0x9f