ATMega128A mit USBASP programmieren

OP #4287812
Lesenswert?

Hallo,

ich versuche verzweifelt einen ATMega128A mit dem USBASP Programmer zu 
programmieren.
Ich schaffe es aber nicht dies reproduzierbar hinzubekommen.
Über ein paar Versuche mir den Fuses bin ich noch nicht hinausgekommen.

Die Beschaltung ist definitiv richtig so wie im Datenblatt gefordert mit 
PE0 und PE1.
Den Pin 1 (PEN) lege ich auf GND.

Dennoch wird der Chip fast nie erkannt:
1
/usr/local/bin/avrdude -C /usr/local/etc/avrdude.conf -p m128 -P usb -c usbasp -F -B 200 -U efuse:r:/tmp/efuse.hex:r -U hfuse:r:/tmp/hfuse.hex:r -U lfuse:r:/tmp/lfuse.hex:r
2

3
avrdude: set SCK frequency to 4000 Hz
4
avrdude: error: programm enable: target doesn't answer. 1 
5
avrdude: initialization failed, rc=-1
6
avrdude: AVR device initialized and ready to accept instructions
7
avrdude: Device signature = 0x8896ef
8
avrdude: Expected signature for ATmega128 is 1E 97 02

Ich weiss nicht woran es liegt?
Egal was ich versuche - es klappt immer nur sporadisch ein Kontakt nach 
dutzenden Versuchen.

Zuletzt habe ich die fuses auf (E:FF, H:90, L:A4) für den internen 
Oszillator programmiert.
Aber auch dann funktioniert es nicht.

Wenn ich es mit dem externen Quarz versuche funktioniert es überhaupt 
nicht, es sei denn ich speise einen externen Takt ein.
Ist das Datenblatt so zu verstehen das bei einem externen Quarz immer 
ein externer Takt für die SPI Programmierung eingespeist werden muss?


Wie programmiert Ihr normalerweise einen ATMega128A?
Angehängte Dateien:
OP #4287829
Lesenswert?

SCK habe ich selbstverständlich verbunden - genauso wie Reset.


Hubert G. schrieb:
> Sieh mal im Datenblatt nach wofür PEN ist.
1
PEN is a programming enable pin for the SPI Serial Programming mode, and is internally pulled high.
2
By holding this pin low during a Power-on Reset, the device will enter the SPI Serial Programming mode.
3
PEN has no function during normal operation.

Es funktioniert ebensowenig den PEN nach dem einschalten wieder 
abzukoppeln und dann zu versuchen zu programmieren.
OP #4287833
Lesenswert?

Jetzt habe ich PEN Mal weggelassen und es funktioniert.

Aber aber aber wieso?

Ich bin mir sicher das ich dies am Anfang auch erfolglos mehrere Male 
probiert habe.
Der Test im Datenblatt sagt doch eindeutig das für SPI Programmierung 
PEN gesetzt sein muss?

Oder bin ich mit SPI total im falschen Film mit einem USBASP?
OP #4287847
Lesenswert?

Hmmm - der PEN wird eigentlich nicht erwähnt.

1
Both the Flash and EEPROM memory arrays can be programmed using the serial SPI bus while RESET is
2
pulled to GND. The serial interface consists of pins SCK, MOSI (input) and MISO (output). After RESET is set
3
low, the Programming Enable instruction needs to be executed first before program/erase operations can be
4
executed. NOTE, in Table 26-13 on page 287, the pin mapping for SPI programming is listed. Not all parts use
5
the SPI pins dedicated for the internal SPI interface. Note that throughout the description about Serial
6
downloading, MOSI and MISO are used to describe the serial data in and serial data out respectively. For
7
ATmega128A these pins are mapped to PDI and PDO.


Wahrscheinlich wollte der Mikrocontroller nur das ich mich im Forum zum 
Deppen mache ... ;-)
#4287863
Lesenswert?

Nicht alles gelesen
As an alternative to using the RESET signal, PEN can be held low
 during Power-on Reset while SCK is set to “0”. In this case, only the 
PEN value at Power-on Reset is important. If the programmer cannot 
guarantee that SCK is held low during power-up, the PEN method cannot be 
used. The device must be powered down in order to commence normal 
operation when using this method.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren