Atmega16u2 Programming Mode is not working.

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

 

Hi, 

 

For Arduino Uno Board Atmega16u2 USB chip, I can not enter into programming mode by using Atmel Studio 7.0 through AVR ICE device. 

 

Please see a note reported years ago below   https://www.avrfreaks.net/comment/2968081#comment-2968081    Which insanely crazy to believe. 

 

Error Message : Atmega16u2 bootloader update is not working. I am getting 0xC0 value instead of 0x00 expected. Off the shelf arduino uno board can not get into programmer mode. Any suggestion?

 

Thanks and best regards,

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

The Atmel ICE does not supply target power, so you must provide it externally, using either the usb connector, or the external power connector!

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

ki0bk wrote:

The Atmel ICE does not supply target power, so you must provide it externally, using either the usb connector, or the external power connector!

Jim

 

 

I do provide the power through USB. But the programmer won;t see the atmega16u2. These boards coming from 3 different company off the shelf Arduino Uno R3 boards. Plus I have my own Arduino Board designed from scratch. All of them not seeing the programmer

 

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

I have a similar problem with the ATtiny24a chip. I have tried the dragon programmer, an older pwm02B and a brand new polu avr v2.1 programmer. All have the same result. I have also set the dragon up to program chips in the onboard socket, same result. I have tried this with about 6 different chips, always 0xc0 error! I have added a .1 bypass to the ATtiny24a's power pins. same result. I have come to the conclusion that it has to be a fault with Studio 7 (which is a fresh install from the web loader about a week ago.

 

On a side note the AVR freaks login has also been giving me fits. It took about 10 password resets over the last few days to even get to the point I could log on here to ask for help.

 

To sum up:

1) power to target - yes

2) bypass cap on target chip power pins - yes

3) three different programmers - yes

4) multiple target chips ( all new) - yes

5) lowered the interface clock to lowest setting ( and several various settings) - yes

 

Please help!

Last Edited: Wed. Oct 14, 2020 - 07:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Post a clear picture of your setup, please!  (use the edit menu that looks like a picture of a mountain, three left of the smiley face )

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

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

Hope this is what you want

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

We all know what AS7 looks like, your h/w setup, show us how you have your programmer connected to the AVR.

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

Wasn't sure: on the two simpler programmers it's via an ISP cable. After several failures I dug out the dragon and wired it up to insert a chip into the onboard connector assuming it was my prototype circuit that was the problem. So I'm not sure what you want me to send. The circuit is a breadboard of a possible project. Triple checked the ISP connections and made sure voltage was applied to target. On the newer AVR programmer I have a green led and the two yellow are sequencing with a pause between flashes.

 

Monty

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

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

??

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

Are these new chips?  Have they ever been programmed that you know of?

If they are new, then the default fuses should have it running in the internal r/c osc, at 1MHZ.

If they have been programmed, and fuses set for either an external xtal or osc, then you will need to supply a clock signal to the xtal1 pin at approx 1MHz.

An Arduino UNO or nano is good for that!  Once the chip has a clock, it can be erased and fuses set to factory default values.

 

Jim

edit: tutorial on how to unbrick an AVR that has lost its clock: https://www.avrfreaks.net/forum/...

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Wed. Oct 14, 2020 - 08:02 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Noticed that I had put f-cpu at 8000000 instead of 1000000.

 

On another note I cannot get the debug wire to enable. What should I be looking for? Is the size of the pullup at 10K a problem? debugWire  just uses the reset line if I remember correctly. I thought about turning on the fuse manually be haven't because of the warning that studio is supposed to handle it automatically.

 

I also noted that Studio 7 says the dragon doesn't support debugwire where it always did before and the manual says it does. So neither the new avr v2.1 programmer or dragon will go into debug.

 

What did I miss this time.

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

123monty wrote:
Noticed that I had put f-cpu at 8000000 instead of 1000000.

Note that does not do anything to the AVR, it only informs the compiler what you THINK the AVR's clock is, so the correct calculations can be done for the built-in delay functions to work correctly.

 

123monty wrote:
On another note I cannot get the debug wire to enable.

Until you can read the signature, nothing works!   So have you solved your ISP issues above?

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

Well the funny part about it is that is the only thing I changed and tried a new part and I was able to read the chip ID.

 

 I still can't get either the avr V2.1 or dragon to go into debug. There is a 10K pullup on reset line. Studio 7 says the dragon doesn’t support debugwire yet the manual says it does so I don't know what is going on.

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

123monty wrote:
Well the funny part about it is that is the only thing I changed and tried a new part and I was able to read the chip ID.

That would seem to suggest the fuse has been changed to use an external clock source on the non working parts.

 

123monty wrote:
 I still can't get either the avr V2.1 or dragon to go into debug.

On the working part, build a project, and then hit the debug and go button, follow the prompts for selecting your tool (programmer/debugger) and it should program and set fuses for debug mode and request you power cycle the chip. Now it's in running in debug mode.  upon exit, it will pop a box asking if you want to disable DW, usually you want to say yes, to restore normal programming mode operation.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

OK, loaded project, went to device programming menu and read part ID of 0x1E910B. Hit start debug arrow (F5) and no prompts but it does rebuild project successfully and downloaded but still not in debug mode. This is with the Avr v2.1 programming tool. Each time I select either F5 or alt F5 all it does is rebuild project, download it and that's all it does. Is there another go to debug button I'm not seeing?

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

123monty wrote:
This is with the Avr v2.1 programming tool.

That is only a programmer, select a debugger (dragon or ICE) then try again.

 

Its possible the other devices have the DW fuse set, it may be worth a try to exit debug mode with one of those devices and see if it AS7 can disable DW mode.

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Thu. Oct 15, 2020 - 03:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

update:

 

Found the available tools menu. Noted it says the Avr 2.1 (stk500) doesn't support debug?? Thought it did. The dragon is supposed to support debugwire but I get the following prompt. Any idea's why?>

 

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

Ok figured that part out. Need to switch dragon to debug wire. But got this after switching:

 

Do I need to remove Pullup on reset line?

 

And when I try to go back to ISP I get this:

 

 

Had to shut everything down and start over to get rid of this.

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

I would not think a 10k pull up would be a problem, did you try to click YES to enter debug mode?

That message just says it tried to enter Debug mode, it could not because it has not yet been enabled, would you like to enable it? (Yes you do)

After this pop up goes away, another will ask you to power cycle to enable DW mode, so do as it says.

Your now in debug mode!

 

Now you can debug, edit, compile, enter debug mode again, rinse and repeat.

 

When your done debugging, you need to exit debugging, and exit DW mode so ISP is once again enabled, these two modes are mutually exclusive!

 

Jim

 

 

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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


Interesting that other dW AVRs have different info compared to the 16U2 datasheet. This in the 328P data for example:

 

 

Which suggests that 10K as a pull-up is the lower limit of what is acceptable. Maybe try 22K or no resistor at all and see if that helps?

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

Got new devices working, now trying to see if I can recover the "damaged" devices. My question is if a device returns an incorrect part ID, just what does that indicate? One is returning 0x1e990b instead of 0x1e910b.

 

Just trying to determine if any are salvageable and thought it might be an indicator of what happened. Also what to do to recover???

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


1E 91 0B is a tiny24 ?!?

 

 

Looking in avrdude.conf (a good source of signatures) I simply cannot find anything that starts 0x1E 0x99.

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

That is what is returned and then errors out. Thought it might be a clue as to what has failed.

Last Edited: Sat. Oct 17, 2020 - 08:47 PM