Forum: Mikrocontroller und Digitale Elektronik Attiny2313 laesst sich nicht programmieren


von Robert (Gast)


Lesenswert?

Hi,

ich hab mir ein paar attiny2313 20pu bestellt und wollte
sie mit meinem 6 Jahre alten Diamex ISP stk500 Programmer programmieren.
Zuletzt habe ich damit erfolgreich einen attiny13 programmiert.
Beim attiny2313 muckt er aber.
Die Pins sind sehr wahrscheinlich richtig
angeschlossen, ich habe es in diversesten Ausfuehrungen
probiert: mit 100nF Kondensator zwischen vcc und gnd, mit
900nF zwischen vcc und gnd, mit 40k Resistor zwischen reset und vcc.
Ausserdem den Programmer auf 3,3V und 5V ausprobiert.
Avrdude liefert mir unterschiedliche Fehlermeldungen,
die beste davon sieht wie folgt aus:
1
avrdude -P /dev/ttyACM0 -c stk500 -p t2313 -Uflash:w:blink.hex:a -B16
2
3
avrdude: AVR device initialized and ready to accept instructions
4
5
Reading | ################################################## | 100% 0.00s
6
7
avrdude: Device signature = 0x1e910a (probably t2313)
8
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
9
         To disable this feature, specify the -D option.
10
avrdude: erasing chip
11
avrdude: reading input file "blink.hex"
12
avrdude: input file blink.hex auto detected as Intel Hex
13
avrdude: writing flash (64 bytes):
14
15
Writing | ################################################## | 100% 0.02s
16
17
avrdude: 64 bytes of flash written
18
avrdude: verifying flash memory against blink.hex:
19
avrdude: load data flash data from input file blink.hex:
20
avrdude: input file blink.hex auto detected as Intel Hex
21
avrdude: input file blink.hex contains 64 bytes
22
avrdude: reading on-chip flash data:
23
24
Reading | ################################################## | 100% 0.01s
25
26
avrdude: verifying ...
27
avrdude: verification error, first mismatch at byte 0x0000
28
         0xff != 0x12
29
avrdude: verification error; content mismatch
30
avrdude: safemode: Fuses OK (E:FF, H:DF, L:64)
31
avrdude done.  Thank you.

Die Fuses sehen also aus wie sie im Auslieferungszustand aussehen 
sollten.
Und theoretisch sollte er das Programm sogar geschrieben haben,
es laeuft allerdings nicht.
Das Programm:
1
#include <avr/io.h>
2
3
int main(void) {    
4
        DDRB = 1;    
5
        while (1) {        
6
                PORTB = 1;        
7
                } 
8
                }

Meistens endet es allerdings in so einem Fehler:
1
avrdude: AVR device initialized and ready to accept instructions
2
3
Reading | ################################################## | 100% 0.00s
4
5
avrdude: Device signature = 0x1e91ff
6
avrdude: Expected signature for ATtiny2313 is 1E 91 0A
7
         Double check chip, or use -F to override this check.
8
avrdude done.  Thank you.

Hier mal eine avrdude -vvv Ausgabe:
1
avrdude -B16 -vvv -P /dev/ttyACM0 -c stk500 -p t2313 -Uflash:w:blink.hex:a
2
3
avrdude: Version 6.3-20171130
4
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
5
         Copyright (c) 2007-2014 Joerg Wunsch
6
7
         System wide configuration file is "/etc/avrdude.conf"
8
         User configuration file is "~/.avrduderc"
9
         User configuration file does not exist or is not a regular file, skipping
10
11
         Using Port                    : /dev/ttyACM0
12
         Using Programmer              : stk500
13
         Setting bit clk period        : 16.0
14
avrdude: stk500v2_getsync(): found STK500 programmer
15
avrdude: Skipping parameter write; parameter value already set.
16
         AVR Part                      : ATtiny2313
17
         Chip Erase delay              : 9000 us
18
         PAGEL                         : PD4
19
         BS2                           : PD6
20
         RESET disposition             : possible i/o
21
         RETRY pulse                   : SCK
22
         serial program mode           : yes
23
         parallel program mode         : yes
24
         Timeout                       : 200
25
         StabDelay                     : 100
26
         CmdexeDelay                   : 25
27
         SyncLoops                     : 32
28
         ByteDelay                     : 0
29
         PollIndex                     : 3
30
         PollValue                     : 0x53
31
         Memory Detail                 :
32
33
                                  Block Poll               Page                       Polled
34
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
35
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
36
           eeprom        65     6     4    0 no        128    4      0  4000  4500 0xff 0xff
37
                                  Block Poll               Page                       Polled
38
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
39
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
40
           flash         65     6    32    0 yes      2048   32     64  4500  4500 0xff 0xff
41
                                  Block Poll               Page                       Polled
42
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
43
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
44
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
45
                                  Block Poll               Page                       Polled
46
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
47
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
48
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
49
                                  Block Poll               Page                       Polled
50
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
51
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
52
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
53
                                  Block Poll               Page                       Polled
54
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
55
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
56
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
57
                                  Block Poll               Page                       Polled
58
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
59
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
60
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
61
                                  Block Poll               Page                       Polled
62
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
63
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
64
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00
65
66
         Programmer Type : STK500V2
67
         Description     : Atmel STK500
68
         Programmer Model: STK500
69
         Hardware Version: 10
70
         Firmware Version Master : 2.10
71
avrdude: stk500v2_command(): command failed
72
avrdude: stk500v2_getparm(): failed to get parameter 0x9a
73
         Topcard         : Unknown
74
         Vtarget         : 5.0 V
75
         SCK period      : 17.4 us
76
         Varef           : 5.0 V
77
         Oscillator      : Off
78
79
avrdude: AVR device initialized and ready to accept instructions
80
81
Reading |                                                    | 0% 0.00savrdude: stk500isp_read_byte(.., signature, 0x0, ...)
82
avrdude: stk500isp_read_byte(): Sending read memory command: avrdude: stk500isp_read_byte(.., signature, 0x1, ...)
83
Reading | #################                                  | 33% 0.00savrdude: stk500isp_read_byte(.., signature, 0x2, ...)
84
Reading | ################################################## | 100% 0.00s
85
86
avrdude: Device signature = 0x1e010a
87
avrdude: Expected signature for ATtiny2313 is 1E 91 0A
88
         Double check chip, or use -F to override this check.
89
90
avrdude done.  Thank you.

Er hat also Probleme bei der Datenuebertragung.
Das Einzige was mit noch einfaellt ist, dass die baudrate nicht
stimmt. Da hab ich jetzt aber auch schon verschiedenste
Werte ausprobiert. Die low Fuse sagt, dass er mit dem internen 8mhz
Oszilator laeuft.

Irgendwelche Ideen, was ich noch ausprobieren koennte?
Ansonsten irgendwelche zuverlaessigen ISP-Programmer Empfehlungen?

schoene Gruesse,
Robert

von Einer K. (Gast)


Lesenswert?

Robert schrieb:
> Die Pins sind sehr wahrscheinlich richtig
> angeschlossen,
Das sehe ich auch so!
Denn die Signatur kann es ja wenigstens manchmal (halb) lesen.

Ich tippe auf unsaubere Stromversorgung.
Wackelige Verbindungen
Fehlende Abblockkondensatoren

Irgendwas in der Richtung.

--------

Robert schrieb:
> Ansonsten irgendwelche zuverlaessigen ISP-Programmer Empfehlungen?
KA, sollte jeder können!

Meine können den ATtiny2313!
1. Atmel ICE
2. USBasp
3. Arduino as ISP
Alle drei mehrfach dafür genutzt....

von Andreas B. (bitverdreher)


Lesenswert?

Versuche es mal mit -B50 statt -B16. Dann taktet die Programmierung 
langsamer.

von Robert (Gast)


Lesenswert?

Wow danke!
Das funktioniert zuverlaessig und reibungslos.
Ich bin beim ausprobieren dummerweise davon ausgegangen,
dass niedrigere Werte mit einer langsameren Taktung
verbunden sind, wie das bei der baudrate ja der Fall ist.



liebe Gruesse,
Robert

von Andreas B. (bitverdreher)


Lesenswert?


Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.