Issues programming TVBgone kit using usbtinyisp
Moderators: adafruit_support_bill, adafruit

Issues programming TVBgone kit using usbtinyisp

by caitsith2 on Wed Nov 14, 2007 3:21 am

I am having issues in trying to program my TVBgone with custom firmware, using the usbtinyisp. I have managed to get as far as having the computer recognize that the usbtinyisp is connected, but nothing further. A simple command to read the currently flashed firmware returns the following result.

Code: Select all | TOGGLE FULL SIZE
avrdude -c usbtiny -p t85 -F -U flash:r:testfile:r

avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATtiny85 is 1E 93 0B
avrdude: reading flash memory:

Reading | ################################################## | 100% 4.30s



avrdude: writing output file "testfile"

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


I have scanned the top and bottom side of both my TV-B-Gone kit and my USBTinyISP kit.



The TV-B-Gone kit currently works fine as it is, but I wanted to flash the custom code-compressed firmware to it. (The white spot on a few of the TV-B-Gone solder joints are from the sticky tape.)
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

by caitsith2 on Thu Nov 15, 2007 12:02 am

Could it be the way the fuses are programmed on the TV-B-Gone kit AVR? I have done a few loopback tests, and got results that seem to indicate that the programmer itself is working.

Loopback MOSI to MISO, should result in a result of whatever is sent on the raw output will be received back on the input. Loopback of MISO to SCK should result in all 0xFF on the input, as SCK goes high on reading the input, then low to write the desired output, and loopback to RST gets all 0x00, as RST is set low, for programming functions.
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

by Seanernet on Thu Nov 15, 2007 8:14 pm

I'm having the same exact problem and if I run Avrdude without the -F it just gives initialization failed, rc=-1

Any simple way to read and write to the t85 with usbtiny??

Thanks,
Sean
Seanernet
 
Posts: 25
Joined: Thu Nov 15, 2007 8:06 pm

by caitsith2 on Sat Nov 17, 2007 7:34 am

I just quickly hacked up a parallel port programmer, using an old printer cable I had, and from there, managed to program the tvbgone AVR with opossum's code compressed firmware. Now I know its a problem with the programmer, rather than the avr or tvbgone kit itself.

The hacked up programmer had a consistency problem with MISO not always getting its data reliably, and that was because I didn't have a 47 ohm resistor on hand, but I did have 1K resistors for the Input lines, and even when MISO wasn't responding 100%, MOSI and SCK seems to have been.
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

by adafruit on Sat Nov 17, 2007 9:23 pm

it seems like the tvbgone kits sometimes dont like being programmed because the LEDs take so much power they pin the data lines and confuse the programmer. you can just clip some of the 47 ohm resistors (and then solder them back when you're done) and it should work
User avatar
adafruit
 
Posts: 11740
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by caitsith2 on Sun Nov 18, 2007 12:32 am

Actually, Given the parallel port hack up fall back, I decided to bypass usbtiny not recognizing the chip, and issue the chip erase command, and it did indeed erase the chip, suggesting that the command being transmitted is being received by the chip. The reply by the chip for some reason though, seems to always be all zero, even though the command actually did go through. Ditto with making usbtiny write the program despite failure to recognize signature. The MOSI, SCK, and RST lines all seem to be received by the ATTiny85, but the MISO line transmitted by ATTiny85 seems to only work part of the time on the parallel port programmer hackup, but has never worked at all on usbtiny.
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

by adafruit on Thu Nov 22, 2007 2:30 am

yeah this pretty much has to do with that line being pinned
User avatar
adafruit
 
Posts: 11740
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by caitsith2 on Thu Nov 22, 2007 3:09 am

I guess V1.1 of the board should add a jumper to disconnect that line from the IR output, for programming purposes then.

----------- EDIT ------------------

I modded my TV-B-Gone board by performing as follows.

Image

--- EDIT ----

Actually, Out of curiosity, I decided to try wiring a 1K resistor between the the 2 black X points, and it seems I now get the best of both worlds. Still needs some extensive field testing though, but this might be even better than having to pull a jumper every single time.
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

by Seanernet on Sun Nov 25, 2007 10:53 pm

Hello,

I have followed both suggestions with negative results. I am attempting to read the flash from the current t85 on the tvbgone in order to program additional t85s for more units. I purchased the usbtiny kit and assembled it with no problems. The unit is found by my computer and the drivers are installed. The tvbgone has worked flawlessly with excellent range. Now I would like to build some more. It seems like no matter what I do, avrdude just replies initialization failed, rc=-1.

I've double checked all the connections on my usbtiny. No apparent problem. I've attempted to connect with avrdude in dos and avr8 burn-o-mat. While using avrdude I use the following "avrdude -c usbtiny -p t85 -U flash:r:testing.hex:i" I've also tried many other commands. All give the same error.

I disconnected the resistors as suggested above and I am still receiving the same error. I configured my tvbgone in the above pictured configuration and it still fails the same way.

After hitting enter for avrdude, the red light on the usbtiny blinks one time, the green light remains solid. The tvbgone then activates as if I hit the on button.

Any help would be greatly appreciated. I bought the usbtiny to try to learn more instead of taking the easy way of purchasing more t85's preprogrammed. It feels now after several hours that I made a mistake.

Thank you,
Sean

P.S. I forgot to mention, I tried avrdude with the "-F" command and avrdude replies, initialization failed, rc=-1, Device signature = 0x000000
Yikes! Invalide device signature. Expected signature for ATtiny85 is 1E 93 0B, reading flash memory, 100%. It writes a file 19.2kb that is virtually empty.
Seanernet
 
Posts: 25
Joined: Thu Nov 15, 2007 8:06 pm

by caitsith2 on Mon Nov 26, 2007 1:40 am

Which resistors did you disconnect. If it was the four IR led resistors, then programming, or whatever you were doing in AVRdude should have succeeded.

I myself ended up doing lots of troubleshooting, to find out what was up. This has to be a programmer issue if even disconnecting the 4 IR LED resistors has no effect for you.

------- EDIT ---------

If you have a blank ATTiny85, then try writing the TVBgone firmware, using the -F override command, and see if that works. If it does, and the green led starts blinking after the write, then the signal is getting through to the AVR.

for a precompiled firmware, if you don't have one, (you were trying to read it off of your one good chip, right?), use http://www.caitsith2.net/projects/tvbgo ... one_na.zip

If that does work, then all of the other AVR ISP commands will work, including the writing of fuses.
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

by seadog on Mon Nov 26, 2007 2:34 pm

caitsith2 wrote:
Actually, Out of curiosity, I decided to try wiring a 1K resistor between the the 2 black X points, and it seems I now get the best of both worlds. Still needs some extensive field testing though, but this might be even better than having to pull a jumper every single time.


I confirm the resistor fix. Now the tvbgone reprograms and validates correctly using dasa programmer!

thnx caitsith2 :)
seadog
 
Posts: 3
Joined: Tue Oct 30, 2007 4:13 pm

by Seanernet on Mon Nov 26, 2007 7:17 pm

caitsith2,

Thank you for taking the time to respond as this is frustrating. It was the four IR led resistors that I disconnected. I have 5 blank AtTiny85's brand new from mouser.com. I tried what you said on one and it failed. Tried a second one and it failed as well.

Here is what I entered and here is the response:

C:\WinAVR>avrdude -c usbtiny -p t85 -U flash:w:tvbgone.hex:i -F

avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny85 is 1E 93 0B
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 "tvbgone.hex"
avrdude: writing flash (2932 bytes):

Writing | ################################################## | 100% 1.97s



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

Reading | ################################################## | 100% 1.53s



avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x63 != 0x00
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK

avrdude done. Thank you.


The red light on the usbtiny stays lit as avrdude attempts to program it. After it is done, the tvbgone fails to turn on.

Thank you again for your help and thank you for the precompiled firmware as I did not have it.

Sean
Seanernet
 
Posts: 25
Joined: Thu Nov 15, 2007 8:06 pm

by caitsith2 on Mon Nov 26, 2007 8:38 pm

Definitely a programmer issue then, as the flashing should have succeeded.

Now on to doing what I did, when I first had issues, before quickly hacking up a DT006 parallel port programmer.



Image
Looking into your 10 pin IDC programmer plug in that orientation, thats your plug pinout.

All trouble shooting steps will require you to have your programmer be supplying power to the board, as you will not actually be connecting the cable to the board.

You will need to enter "avrdude -c usbtiny -p t85 -Ft". This will enter AVRDude into terminal mode, where you will see the effects of the troubleshooting steps.

Step 1. Jump pins 2 and Pins 9. (This is Vcc to MISO.) Now in the terminal, type "send 0x12 0x34 0x56 0x78". If MISO is working, you should get "results: ff ff ff ff".

Next, jump pins 9 and Pins 10. (This is Gnd to MISO.) Result of "send 0x12 0x34 0x56 0x78" should be "results: 00 00 00 00".

Next, jump pins 1 and pins 9. (This is MOSI to MISO) Results of "send 0x12 0x34 0x56 0x78" should be results: 12 34 56 78".

Finally, type quit to exit AVRdude's terminal mode. (and report the results of all of the tests.) (the first 2 tests will actually check to see if MISO is working correctly, and the 3rd test checks to see if both MOSI and MISO are working correctly. There is no easy test for either reset or sck though.
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

by Seanernet on Mon Nov 26, 2007 10:17 pm

C:\WinAVR>avrdude -c usbtiny -p t85 -Ft

avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny85 is 1E 93 0B
avrdude> send 0x12 0x34 0x56 0x78
>>> send 0x12 0x34 0x56 0x78
results: ff ff ff ff

avrdude> send 0x12 0x34 0x56 0x78
>>> send 0x12 0x34 0x56 0x78
results: 00 00 00 00

avrdude> send 0x12 0x34 0x56 0x78
>>> send 0x12 0x34 0x56 0x78
results: 12 34 56 78

avrdude> quit
Seanernet
 
Posts: 25
Joined: Thu Nov 15, 2007 8:06 pm

by caitsith2 on Mon Nov 26, 2007 10:40 pm

Okay, if it got that far, jumping pins 5 and 9 should act as if you jumped 9 and 10, and jumping pins 7 and 9 should act like you just jumped 9 and 2.

(Pin 5 is reset, which is asserted low during the programming phase, and Pin 7 is SCK, which is asserted Low while transmitting a bit through MOSI, and then asserted high to receive a bit through MISO.)

If these tests succeed, then go with a multimeter in continuity mode, and check the programming lines on the TVBGone.

IDC Pin - AVR Pin
1 - 5
2 - 8
3 - NC
4 - 4
5 - 1
6 - 4
7 - 7
8 - 4
9 - 6
10 - 4

If connected properly, there should be about 0 resistance. (remove the batteries from TVBGone for this test.)
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm