PDA

View Full Version : Triks-C - trouble programming chip, please help!



BadWolf
05-03-2009, 10:36 PM
Hello, I've been trying to program the ATtiny2313 chip for the Triks-c for the past few days, but it always fails at the verification stage. The error happens at a different byte each time I try.

I am using the USBtiny programmer from LadyAda. I have tried it letting the programmer supply power, and also with an external power supply, but the results are the same.

I can program the fuses OK, but not the flash memory. I'm not sure if it is the writing or reading that fails. If I set the jumper on the triks-c to stand alone, the "diag" led will usually blink after programming, but not always.

I am using the latest AVRDUDE. If you have any ideas what I am doing wrong, please let me know.

I'm going to attach what I see in the command window.

Thanks!



C:\christmas lights\triks-c>avrdude -c usbtiny -p attiny2313 -U flash:w:triksc02.hex -vvvv

avrdude: Version 5.6, compiled on Mar 5 2009 at 09:59:30
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

System wide configuration file is "C:\WinAVR\bin\avrdude.conf"

Using Port : lpt1
Using Programmer : usbtiny
AVR Part : ATtiny2313
Chip Erase delay : 9000 us
PAGEL : PD4
BS2 : PD6
RESET disposition : possible i/o
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 6 4 0 no 128 4 0 4000 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 6 32 0 yes 2048 32 64 4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 2 0 0 0 0 0x00 0x00

Programmer Type : USBtiny
Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 53 00]
avrdude: AVR device initialized and ready to accept instructions

Reading | | 0% 0.00sCMD: [30 00 00 00] [00 30 00 1e]
CMD: [30 00 01 00] [00 30 00 91]
Reading | ################# | 33% 0.02sCMD: [30 00 02 00] [00 30 00 0a]
Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e910a
CMD: [50 00 00 00] [00 50 00 ef]
avrdude: safemode read 1, lfuse value: ef
CMD: [50 00 00 00] [00 50 00 ef]
avrdude: safemode read 2, lfuse value: ef
CMD: [50 00 00 00] [00 50 00 ef]
avrdude: safemode read 3, lfuse value: ef
avrdude: safemode: lfuse reads as EF
CMD: [58 08 00 00] [00 58 08 df]
avrdude: safemode read 1, hfuse value: df
CMD: [58 08 00 00] [00 58 08 df]
avrdude: safemode read 2, hfuse value: df
CMD: [58 08 00 00] [00 58 08 df]
avrdude: safemode read 3, hfuse value: df
avrdude: safemode: hfuse reads as DF
CMD: [50 08 00 00] [00 50 08 ff]
avrdude: safemode read 1, efuse value: ff
CMD: [50 08 00 00] [00 50 08 ff]
avrdude: safemode read 2, efuse value: ff
CMD: [50 08 00 00] [00 50 08 ff]
avrdude: safemode read 3, efuse value: ff
avrdude: safemode: efuse reads as FF
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
CMD: [a0 00 7c 00] [00 a0 00 ff]
CMD: [a0 00 7d 00] [00 a0 00 ff]
CMD: [a0 00 7e 00] [00 a0 00 ff]
CMD: [a0 00 7f 00] [00 a0 00 ff]
avrdude: erasing chip
CMD: [ac 80 00 00] [00 ac 80 00]
avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 ac 53 00]
avrdude: reading input file "triksc02.hex"
avrdude: input file triksc02.hex auto detected as Intel Hex
avrdude: writing flash (1968 bytes):

Writing | | 0% 0.00sCMD: [4c 00 00 00] [95 4c 00 00]
Writing | # | 1% 0.10sCMD: [4c 00 10 00] [22 4c 00 10]
Writing | ## | 3% 0.23sCMD: [4c 00 20 00] [00 4c 00 20]
Writing | ## | 4% 0.31sCMD: [4c 00 30 00] [b8 4c 00 30]
Writing | ### | 6% 0.40sCMD: [4c 00 40 00] [ff 4c 00 40]
Writing | #### | 8% 0.51sCMD: [4c 00 50 00] [02 4c 00 50]
Writing | ##### | 9% 0.62sCMD: [4c 00 60 00] [ff 4c 00 60]
Writing | ###### | 11% 0.73sCMD: [4c 00 70 00] [ff 4c 00 70]
Writing | ####### | 13% 0.83sCMD: [4c 00 80 00] [02 4c 00 80]
Writing | ####### | 14% 0.94sCMD: [4c 00 90 00] [ff 4c 00 90]
Writing | ######## | 16% 1.05sCMD: [4c 00 a0 00] [00 4c 00 a0]
Writing | ######### | 17% 1.14sCMD: [4c 00 b0 00] [00 4c 00 b0]
Writing | ########## | 19% 1.24sCMD: [4c 00 c0 00] [00 4c 00 c0]
Writing | ########### | 21% 1.33sCMD: [4c 00 d0 00] [00 4c 00 d0]
Writing | ########### | 22% 1.42sCMD: [4c 00 e0 00] [00 4c 00 e0]
Writing | ############ | 24% 1.51sCMD: [4c 00 f0 00] [00 4c 00 f0]
Writing | ############# | 26% 1.60sCMD: [4c 01 00 00] [00 4c 01 00]
Writing | ############## | 27% 1.69sCMD: [4c 01 10 00] [00 4c 01 10]
Writing | ############### | 29% 1.79sCMD: [4c 01 20 00] [00 4c 01 20]
Writing | ############### | 30% 1.88sCMD: [4c 01 30 00] [00 4c 01 30]
Writing | ################ | 32% 1.97sCMD: [4c 01 40 00] [00 4c 01 40]
Writing | ################# | 34% 2.05sCMD: [4c 01 50 00] [00 4c 01 50]
Writing | ################## | 35% 2.14sCMD: [4c 01 60 00] [00 4c 01 60]
Writing | ################### | 37% 2.23sCMD: [4c 01 70 00] [00 4c 01 70]
Writing | #################### | 39% 2.33sCMD: [4c 01 80 00] [00 4c 01 80]
Writing | #################### | 40% 2.42sCMD: [4c 01 90 00] [00 4c 01 90]
Writing | ##################### | 42% 2.51sCMD: [4c 01 a0 00] [00 4c 01 a0]
Writing | ###################### | 43% 2.60sCMD: [4c 01 b0 00] [00 4c 01 b0]
Writing | ####################### | 45% 2.69sCMD: [4c 01 c0 00] [b6 4c 01 c0]
Writing | ######################## | 47% 2.78sCMD: [4c 01 d0 00] [e0 4c 01 d0]
Writing | ######################## | 48% 2.87sCMD: [4c 01 e0 00] [30 4c 01 e0]
Writing | ######################### | 50% 2.96sCMD: [4c 01 f0 00] [38 4c 01 f0]
Writing | ########################## | 52% 3.05sCMD: [4c 02 00 00] [30 4c 02 00]
Writing | ########################### | 53% 3.14sCMD: [4c 02 10 00] [e0 4c 02 10]
Writing | ############################ | 55% 3.23sCMD: [4c 02 20 00] [24 4c 02 20]
Writing | ############################ | 56% 3.32sCMD: [4c 02 30 00] [24 4c 02 30]
Writing | ############################# | 58% 3.41sCMD: [4c 02 40 00] [0f 4c 02 40]
Writing | ############################## | 60% 3.51sCMD: [4c 02 50 00] [bf 4c 02 50]
Writing | ############################### | 61% 3.60sCMD: [4c 02 60 00] [b7 4c 02 60]
Writing | ################################ | 63% 3.69sCMD: [4c 02 70 00] [e0 4c 02 70]
Writing | ################################# | 65% 3.78sCMD: [4c 02 80 00] [b9 4c 02 80]
Writing | ################################# | 66% 3.87sCMD: [4c 02 90 00] [2e 4c 02 90]
Writing | ################################## | 68% 3.95sCMD: [4c 02 a0 00] [f7 4c 02 a0]
Writing | ################################### | 69% 4.05sCMD: [4c 02 b0 00] [27 4c 02 b0]
Writing | #################################### | 71% 4.14sCMD: [4c 02 c0 00] [0f 4c 02 c0]
Writing | ##################################### | 73% 4.25sCMD: [4c 02 d0 00] [95 4c 02 d0]
Writing | ##################################### | 74% 4.34sCMD: [4c 02 e0 00] [9a 4c 02 e0]
Writing | ###################################### | 76% 4.44sCMD: [4c 02 f0 00] [f4 4c 02 f0]
Writing | ####################################### | 78% 4.52sCMD: [4c 03 00 00] [96 4c 03 00]
Writing | ######################################## | 79% 4.61sCMD: [4c 03 10 00] [e1 4c 03 10]
Writing | ######################################### | 81% 4.70sCMD: [4c 03 20 00] [91 4c 03 20]
Writing | ######################################### | 82% 4.79sCMD: [4c 03 30 00] [27 4c 03 30]
Writing | ########################################## | 84% 4.88sCMD: [4c 03 40 00] [83 4c 03 40]
Writing | ########################################### | 86% 4.98sCMD: [4c 03 50 00] [91 4c 03 50]
Writing | ############################################ | 87% 5.07sCMD: [4c 03 60 00] [95 4c 03 60]
Writing | ############################################# | 89% 5.15sCMD: [4c 03 70 00] [91 4c 03 70]
Writing | ############################################## | 91% 5.25sCMD: [4c 03 80 00] [1f 4c 03 80]
Writing | ############################################## | 92% 5.34sCMD: [4c 03 90 00] [81 4c 03 90]
Writing | ############################################### | 94% 5.43sCMD: [4c 03 a0 00] [f7 4c 03 a0]
Writing | ################################################ | 95% 5.53sCMD: [4c 03 b0 00] [eb 4c 03 b0]
Writing | ################################################# | 97% 5.63sCMD: [4c 03 c0 00] [e6 4c 03 c0]
Writing | ################################################## | 99% 5.72sCMD: [4c 03 d0 00] [ce 4c 03 d0]
Writing | ################################################## | 100% 5.76s



avrdude: 1968 bytes of flash written
avrdude: verifying flash memory against triksc02.hex:
avrdude: load data flash data from input file triksc02.hex:
avrdude: input file triksc02.hex auto detected as Intel Hex
avrdude: input file triksc02.hex contains 1968 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.18s



avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x00e7
0xff != 0x01
avrdude: verification error; content mismatch

CMD: [50 00 00 00] [ce 50 00 ef]
avrdude: safemode read 1, lfuse value: ef
CMD: [50 00 00 00] [00 50 00 ef]
avrdude: safemode read 2, lfuse value: ef
CMD: [50 00 00 00] [00 50 00 ef]
avrdude: safemode read 3, lfuse value: ef
avrdude: safemode: lfuse reads as EF
CMD: [58 08 00 00] [00 58 08 df]
avrdude: safemode read 1, hfuse value: df
CMD: [58 08 00 00] [00 58 08 df]
avrdude: safemode read 2, hfuse value: df
CMD: [58 08 00 00] [00 58 08 df]
avrdude: safemode read 3, hfuse value: df
avrdude: safemode: hfuse reads as DF
CMD: [50 08 00 00] [00 50 08 ff]
avrdude: safemode read 1, efuse value: ff
CMD: [50 08 00 00] [00 50 08 ff]
avrdude: safemode read 2, efuse value: ff
CMD: [50 08 00 00] [00 50 08 ff]
avrdude: safemode read 3, efuse value: ff
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK

avrdude done. Thank you.
Later.. .. . . . . Brad

cbell
05-03-2009, 10:45 PM
Does the Triks-C use an external oscillator? If so, once you set the fuses for an external oscillator, you can no longer program the chip unless an external oscillator is attached to it. I had this problem when building RPM's DMX Grinch controller, and the only way I could fix it was to build a small programming circuit on a breadboard with an external oscillator similar to what I had programmed the fuses to use, and then I was able to talk to the chip again.

If the Triks-C doesn't use an external oscillator, then by all means, please ignore this post :p

TimW
05-04-2009, 09:40 AM
I use the same programmer with AVRDUDE v5.5. (looks like you are using 5.6... not sure if this is problem or not because the programmer seems to be recognised fine)

When I program the Triks-C with verbose modes on I'm seeing the same output as you... EXCEPT mine programs 4 seconds faster (in about 1.6 seconds not 5.7).

Check the crystal on the board (and the solder joints of the 22pF caps around the crystal). Is the crystal the right speed?

As Cbell mentions if there's a problem with the external osc you are likely to have programming issues. Triks C has an external crystal - but its usually programmed in circuit so the crystal is always there...

Are the header plugs on your programmer making good connection with the headers (both the Triks-C header and the one inside the usbtiny?)

Did you at any time insert the chip the wrong way around? The 2313 hates that.... (and if this happens it may have damaged but not destroyed it...). But I'd start with the crystal and the isp connections.

BadWolf
05-04-2009, 11:58 AM
Chris, the Triks-C does use an external osc., but since I am trying to program the chip while it's on the triks-c board, I think that it should be OK to program the fuses first.

Later. . . . . . .Brad


Does the Triks-C use an external oscillator? If so, once you set the fuses for an external oscillator, you can no longer program the chip unless an external oscillator is attached to it. I had this problem when building RPM's DMX Grinch controller, and the only way I could fix it was to build a small programming circuit on a breadboard with an external oscillator similar to what I had programmed the fuses to use, and then I was able to talk to the chip again.

If the Triks-C doesn't use an external oscillator, then by all means, please ignore this post :p

BadWolf
05-04-2009, 12:01 PM
Check the crystal on the board (and the solder joints of the 22pF caps around the crystal). Is the crystal the right speed?


I will check the crystal tonight when I get home.



Did you at any time insert the chip the wrong way around? The 2313 hates that.... (and if this happens it may have damaged but not destroyed it...). But I'd start with the crystal and the isp connections.

No, I never had the chips in wrong. Also I have two triks-c boards, and both of them act the same.

Later. . . . . . .. Brad

BadWolf
05-04-2009, 09:59 PM
When I program the Triks-C with verbose modes on I'm seeing the same output as you... EXCEPT mine programs 4 seconds faster (in about 1.6 seconds not 5.7).

I checked the crystal and the cable and all connections and all looked good. Your statement above got me thinking that maybe my laptop's USB port was not fast enough. It's an old v1.1 usb port. So I tried an expansion card USB port that I had laying around, and it works perfectly with the programmer! It now programs in the same time as you are getting. (with no errors)

Thanks for the help!

Later. . . . . . . Brad

RPM
05-06-2009, 09:42 PM
That's strange... I have always thought that programmer would work at USB1.1 since there is a statement in the documentation that says "USBtiny is a software implementation of the USB low-speed protocol for the Atmel ATtiny microcontrollers".

Robert

BadWolf
05-06-2009, 10:55 PM
That's strange... I have always thought that programmer would work at USB1.1 since there is a statement in the documentation that says "USBtiny is a software implementation of the USB low-speed protocol for the Atmel ATtiny microcontrollers".

Robert

Maybe the USBtiny just doesn't like the USB port in my laptop? I thought that it should work with USB 1.1 also.....

Later. . . . . . .. Brad