Used TinyISP once ... now USB won't load programs

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

 

This is strange.  I was uploading sketches fine with the USB to a MEGA.  I was working with Atmel Studio and checking out some equipment.  I used the TinyISP to load ONE sketch to see if that was still OKAY.

 

Now I can't load sketches through the USB port.  It times out.  Tried it on 3 different computers that this board worked on in the past.  So something happened when I used the TinyISP.

 

any ideas how I can fix this?  Has this happened to anyone else in the past?  If it is the TinyISP programmer --- and it caused a permanent problem, I have a solution (and a BIG hammer ;-)

 

I'd like to fix this.

 

thanks for your help!

Eddie

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is probably not strange at all.

 

When you buy an Arduino the AVR on it comes with a part of its flash loaded with a program called a bootloader. This is what the Arduino development environment "talks to" when uploading a sketch. The bootloader is an ordinary AVR program - the only thing special with it is that it resides in a specific part of flash. But in flash it is, so erasable it is.

 

When the Arduino environment talks to the bootloader it in turn writes your sketch to the rest of the flash. Then your sketch can execute from there. Think of the bootloader as an AVR flash programmer implemented in te AVR itself.

 

When you use ISP it is normal that the ISP programmer/software erases ALL of flash before programming it with new code.

 

This is likely what happened to your Arduino. The bootloader is gone, and without it you can not use the Arduino development environment to program it.

 

You need to get a fresh copy of the bootloader in there somehow. I know there are ways to do this, but have no details since I never needed this myself. Wait here for someone more informed on the details to pass by. Or start Googling based on what I have told you.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sat. Oct 24, 2015 - 01:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You connect your USBTiny to the ISP header on the Arduino with the 6-way ribbon cable.   (This will supply 5V to the Arduino)

Do not connect the Arduino USB cable if you are using a TinyISP.

 

You run the Arduino IDE.   (I suggest v1.6.5)

 

Select your model of Arduino

Select USBtinyISP as Programmer.

Select Burn Bootloader.

 

Remove the ribbon cable.

Connect your Arduino with its own USB cable.

Dig a big hole.  Bury your USBtinyISP.

 

Live a happy life with your Arduino.

 

As Johan said.   If you ever use an ISP programmer,   you destroy the bootloader.    But it is easy to recover.

 

These instructions apply to a STK500, TinyISP or a USBASP because they can supply power.

If you use ATMEL-ICE, Dragon, AVRISP-2, ... they do not provide power.   So you connect the Arduino's own USB cable to power the Arduino.

 

David.

Last Edited: Sat. Oct 24, 2015 - 02:22 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
Dig a big hole. Bury your USBtinyISP.

LOL!

 

Seriously though: Keep your ISP, but tuck it away until you are in a situation where you might want to move away from the Arduino development environment and/or your AVR app needs that last chunk of flash the bootloader occupies.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In all honesty,   a UNO with Optiboot is scarcely noticeable.   i.e. 32256 bytes available

And a MEGA2560 has got so much Flash,   I doubt if you will ever worry about the Flash used by the bootloader.

 

Yes,   AS7 might be useful for debugWIRE on a UNO.   But you need an ATMEL-ICE or Dragon.

No,   a MEGA2560 with JTAG has lost four Analog pins.   And you still need the ATMEL-ICE or Dragon.

 

If you are writing Arduino sketches,   the Arduino IDE works pretty well.

If you are writing ASM, BASIC, C, C++, ... you can still use the Bootloader with whichever IDE suits you.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay - thanks folks.  I'll do that.  That was my first thought - bootloader ... I did try that first. 

 

AVRDUDE said failed - Newbie mistake - I believed it!  So my OTHER thought is perhaps SainSmart and Genuine Arduino require different bootloaders.  Took some time and searched around - NOPE nothing appeared to be different - I considered the possibility my actions trashed the boards permanently.  So the battle of TinyISP vs. BIG HAMMER was about to begin.  Might as well remove the cause of the problem, RIGHT?  Oh, that's right ... it was OPERATOR ERROR. 

 

avrdude: verifying ...

 

Error while burning bootloader.

 

avrdude: verification error, first mismatch at byte 0x3e000

 

         0xff != 0x0d

 

avrdude: verification error; content mismatch

 

So I considered my actions useless.  NEVER considered AVRDUDE could be wrong?  I should have suspected the Arduino IDE environment.  LOL!

With your information I proceeded to burn the bootloader after extending the errors to see what was going on.  The error was only the final verify ... Hmmmmm. 

 

This seemed to work on all the other reads/writes ... data seemed to be consistent between the TWO boards (both were in need of bootloaders) .. let's try an upload - simple one - BLINK.  AH HA!  Success!  In spite of the verification error - this now appears to be working as advertized once again. 

 

IF anyone is interested in the full output - maybe to FIX the verification process?  Unfortunately my experience with Atmel processors is limited.  Back in the dawn of time ... 4004, 8008 and 8080 processors came forth. 

 

Anyhow - the kids and grand kids are going to be happy now.  I can finish the holiday light display now.

 

THANKS AGAIN GUYS!

Eddie

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh - there is one other note I'd like to leave.

 

My experience using TinyISP and the USB for uploading is the USB method is MUCH faster.  Arduino IDE loads and runs on some ancient PC's here but will not use the TinyISP for uploads.  My general use needs the USB.

 

Atmel Studio 6 and 7 - I use them on my desktop but without a high end PC - I've seen molasses  move faster in winter.  Atmel does a great job but MICROSOFT gummed up the gears again.

 

Cheers!

Eddie
 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Although I have no experience with the TinyISP, I am quite familiar with the USBASP. I am sure that both will work just fine. Whether uploading an app or installing a bootloader.

Once you have a bootloader (and a reliable way of starting it), you might just as well use the bootloader. It is reasonably fast. It means ONE usb cable to your AVR. And you cannot brick yourself with inappropriate fuses.

OTOH, if you are using JTAG and hardware debugging, it is worth the extra USB cable for the convenience of an ATMEL-ICE.

If you only have a slow PC, AS6 is not very practical. But the regular Arduino IDE should be quite usable.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hiya David,

 

Yup - AS6 and AS7 work very well for me (especially under Winblows 7).  I haven't been able to stuff this big 'ol box under my arm and head out into the field with it.  Not too many folks remember what it was like before DOS and the IBM PC.  I am still trying to get my head wrapped around C++ these days ... asm, basic, C, cobol, dbase and some other ancient  and obsolete languages is all I knew back when.

 

I'm rusty as all since I don't work in the field like I used to 20 yrs ago. 

 

still struggling w/a simple uart communications issue - Arduino - not a bad environment but does have limitations (and quirks I'm beginning to sort out work-arounds).

 

Thanks again for the assist!

 

Cheers,

Eddie

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hiya David,

 

Yup - AS6 and AS7 work very well for me (especially under Winblows 7).  I haven't been able to stuff this big 'ol box under my arm and head out into the field with it.  Not too many folks remember what it was like before DOS and the IBM PC.  I am still trying to get my head wrapped around C++ these days ... asm, basic, C, cobol, dbase and some other ancient  and obsolete languages is all I knew back when.

 

I'm rusty as all since I don't work in the field like I used to 20 yrs ago. 

 

still struggling w/a simple uart communications issue - Arduino - not a bad environment but does have limitations (and quirks I'm beginning to sort out work-arounds).

 

Thanks again for the assist!

 

Cheers,

Eddie

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'll just add the Dragon WILL power your project if you add one jumper!   I program many boards this way.

 

Jim

 

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My experience using TinyISP and the USB for uploading is the USB method is MUCH faster. 

IIRC, this is because the TinyISP code is essentially a USB to SPI converter, and programming is accomplished by sending individual SPI commands in low-speed (Software-based) USB packet (at a max rate of something like 1 packet per millisecond?)  I think that it only fits a single SPI command in each buffer, so you're talking about a maximum upload rate of less than 1000 bytes/s.

The Bootloaders use an external USB/Serial chip that is "full speed" USB, typically with significantly larger USB packet sizes, AND a protocol that lets the data be sent as page-sized data blocks, rather than about 4x as many SPI commands.

 

People have run the bootloader at 1Mbps, and commented that it approaches or exceeds the speed of native SPI programming with a "good" programmer (because the max SPI datarate into an AVR is about F_CPU/4, and you have a 4x multiplier of SPI bytes vs data bytes...)