The new Raspberry Pi B Model B+ is here - Pick one up in the store and check our detailed guide!

Re: Programming with USBTinyISP

by n6rob on Tue Sep 18, 2012 9:38 pm

Pulled the '168 out and put in on a breadboard with direct connections to the USBtiny. Same results as before.

I think the ATtiny2313 on the USBtinyISP is toast.

Thoughts?
n6rob
 
Posts: 18
Joined: Sun Sep 16, 2012 8:39 pm
Location: Silicon Valley, California, USA

Re: Programming with USBTinyISP

by n6rob on Wed Sep 19, 2012 9:27 pm

I built a basic serial programmer using the parallel port (http://avrprogrammers.com/bld-avr-parallel-programmer-1.php). I was attempting to reprogram the ATtiny2313 in the USBtiny but the chip does not respond.

Any suggestions? I'm feeling a bit lost here...
n6rob
 
Posts: 18
Joined: Sun Sep 16, 2012 8:39 pm
Location: Silicon Valley, California, USA

Re: Programming with USBTinyISP

by adafruit_support_bill on Thu Sep 20, 2012 4:32 am

OK. Let's try replacing the microcontroller. Contact support@adafruit.com with a link to this thread and ask for a USBTinyISP microcontroller.
User avatar
adafruit_support_bill
 
Posts: 28008
Joined: Sat Feb 07, 2009 9:11 am

Re: Programming with USBTinyISP

by n6rob on Thu Sep 20, 2012 9:54 pm

Thank you for the offer. I appreciate it. But I have already ordered a replacement, along with some other goodies. After all, it's my Birthday. :D

Building kits is inherently inaccurate and fraught with mistakes - however unintentional. While I am pretty sure it's the microcontroller that's the problem, what I am NOT sure about is that I didn't kill it myself through some mistake. So bottom-line, I'll pay for a new one. But props to you for making the offer and standing behind the product.

I'm just really anxious to start programming and have my Ice Tube Clock rock a GPS! Gotta love precision time!

Thanks Adafruit.
n6rob
 
Posts: 18
Joined: Sun Sep 16, 2012 8:39 pm
Location: Silicon Valley, California, USA

Re: Programming with USBTinyISP

by n6rob on Sun Sep 23, 2012 5:24 pm

Man, this is hard. I bought a new microcontroller for the USBtiny (preprogrammed, of course), still no joy. Problem is the same as the original post; if I ask it to read or write to the target it hangs at the progress bar. The USB cable is connected through a powered USB hub. I've pulled the '168 from the Ice Tube Clock and put it in a protoboard and tried to address it, alone but got no results. I suspect it needs an outboard crystal which I don't have.

I've ordered some new (naked) '328s from Ebay; I'll see what I can do with those when they arrive (wbp was talking about improvements that take more memory so I went for the larger chip). Maybe I toasted the target. Strange; usually I am not that clumsy, but at this point I'd stand on my head if I thought it could help.

I discovered something new as I was preparing this post. Long story but as a method of diagnostics I had been attempting to read the target's flash memory and accidentally (apparently) corrupted the iv.hex file on my harddrive as it was only 128 bytes in size (I forgot the change the name of the file in the command line so when I read the flash it overwrote the firmware file). Not realizing this the firmware file had been corrupted I observed the programmer worked; meaning it prepared the target, loaded the corrupted file, and verified the results. Whuh? As part of my earlier diagnostics I had tried different versions of hex files thinking maybe that was part of the problem. (Recall the main problem was that the programmer would hang-up during the write process). But now, it worked with a much smaller, corrupted file. Okay. So I made a copy of a un-corrupted hex file, removed all but the first few lines saved the file and tried programming again. Boom-it worked again. Then I tried a full sized hex file. Nope, won't go - it hangs on the write process. I have tried three different hex files. The first is from the Ice Tube Clock "Mods" webpage (which leads to the github) - this being what I believe is the supported firmware (11,142 bytes). The second is a December 2011 version that includes some improvements on the GPS function (15,296 bytes). Third is a later version of the second file that fixed some bugs and is dated July 2012 (16,230 bytes). These last two files were published by wbp; he, grumpygasbag, and brand seem to have got it working. So I assuming it's something on my end.

Avrdude seems to recognize the file as hex, but it hangs consistently on the write process (or read if I choose that instead). I'll paste the output when "successfully" programming with 128 byte file, and with the full hex file, in that order.

Code: Select all | TOGGLE FULL SIZE
rob@tubby:~/Desktop$ avrdude -c usbtiny -p m168 -U flash:w:tst.hex -v

avrdude: Version 5.11svn-20111019, compiled on Sep 15 2012 at 21:04:41
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/local/etc/avrdude.conf"
         User configuration file is "/home/rob/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/parport1
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 001:050
         AVR Part                      : ATMEGA168
         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        512    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     16384  128    128  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 : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406
avrdude: safemode: lfuse reads as E2
avrdude: safemode: hfuse reads as C6
avrdude: safemode: efuse reads as 1
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: Using SCK period of 10 usec
avrdude: reading input file "tst.hex"
avrdude: input file tst.hex auto detected as Intel Hex
avrdude: WARNING: no end of file record found for Intel Hex file "tst.hex"
avrdude: writing flash (128 bytes):

Writing | ################################################## | 100% 0.35s

avrdude: 128 bytes of flash written
avrdude: verifying flash memory against tst.hex:
avrdude: load data flash data from input file tst.hex:
avrdude: input file tst.hex auto detected as Intel Hex
avrdude: WARNING: no end of file record found for Intel Hex file "tst.hex"
avrdude: input file tst.hex contains 128 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.23s

avrdude: verifying ...
avrdude: 128 bytes of flash verified

avrdude: safemode: lfuse reads as E2
avrdude: safemode: hfuse reads as C6
avrdude: safemode: efuse reads as 1
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


Now with the firmware from the github...

Code: Select all | TOGGLE FULL SIZE
rob@tubby:~/Desktop$ avrdude -c usbtiny -p m168 -U flash:w:iv.hex -v

avrdude: Version 5.11svn-20111019, compiled on Sep 15 2012 at 21:04:41
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/local/etc/avrdude.conf"
         User configuration file is "/home/rob/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/parport1
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 001:050
         AVR Part                      : ATMEGA168
         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        512    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     16384  128    128  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 : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406
avrdude: safemode: lfuse reads as E2
avrdude: safemode: hfuse reads as C6
avrdude: safemode: efuse reads as 1
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: Using SCK period of 10 usec
avrdude: reading input file "iv.hex"
avrdude: input file iv.hex auto detected as Intel Hex
avrdude: writing flash (11142 bytes):

Writing |                                                    | 0% 0.00s


You can see that this is where the output ends, I have to control-C to get out of it.
n6rob
 
Posts: 18
Joined: Sun Sep 16, 2012 8:39 pm
Location: Silicon Valley, California, USA

Re: Programming with USBTinyISP

by n6rob on Sun Sep 23, 2012 10:56 pm

Okay, after some (a lot) of playing around, I have apparently fixed the problem. I went through all my software builds (mind you, I am better with a soldering iron than a keyboard, and while I am no neophyte at Linux, I am most certainly not a coder) and re-installed gcc, rebuilt avr-gcc (even though I wasn't writing & building code in this case - I have BIG plans!!), libraries, etc. Also reloaded avrdude and went to 5.11.1; I was at 5.11svn previously (it had the most recent build date). Was very careful to check for libusb-dev (no such thing as libusb in Ubuntu apparently) before building avrdude, per the instructions. I strongly suspect it was reloading avrdude that solved the problem.

Bang! It worked. Software problem. It wasn't a defective micro.

I am now sporting the latests and greatest firmware in my Ice Tube Clock. Now I can wire-up the Ultimate GPS and see what happens. I'll have to snap a photo and post it on the Ice Tube photo thread.

Thanks for your help. :D
n6rob
 
Posts: 18
Joined: Sun Sep 16, 2012 8:39 pm
Location: Silicon Valley, California, USA

Re: Programming with USBTinyISP

by adafruit_support_bill on Mon Sep 24, 2012 5:00 am

Good diagnostic work there. With all those variables, it is tough to nail down the root cause sometimes. :D
User avatar
adafruit_support_bill
 
Posts: 28008
Joined: Sat Feb 07, 2009 9:11 am

Re: Programming with USBTinyISP

by wbp on Wed Sep 26, 2012 2:38 pm

I don't have unix/linux so can't really help with that, but I do have an external programmer and plenty of 168 and 328p chips, and I am in the same neighborhood, so if you want a chip that works, let's talk.

William
wm (at) usa (dot) net
User avatar
wbp
 
Posts: 215
Joined: Mon Mar 07, 2011 12:18 pm

Re: Programming with USBTinyISP

by wbp on Wed Sep 26, 2012 2:41 pm

didn't read far enough to see you got it working, sorry.
for the Ultimate GPS you'll need to change the baud rate. Other than that it should work. I just got one and will be putting it on my Ice Tube clock soon. I plan on modifying my Ice Tube firmware to use the Ultimate GPS for all timekeeping, since it has the RTC function, but haven't had any time to look at this yet...

William
User avatar
wbp
 
Posts: 215
Joined: Mon Mar 07, 2011 12:18 pm