STK500 Will not enter programming mode

Go To Last Post
61 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I am using command line programming. I have three new STK500 boards that are giving me the same error. I have an older STK 500 board that is working flawlessly. These STK500 boards are used for production programming.

With the failing boards I get this error when I use the following command:  stk500 -dATmega168 -s

 

the error goes like this.

 

STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.

Scanning ports:
COM1 ... Port busy or STK500 not connected
COM2 ... Port busy or STK500 not connected
COM3 ... Port busy or STK500 not connected
COM4 ... Port busy or STK500 not connected
COM5 ... Connected to STK500 V2 on port COM5
Device parameters loaded
Could not enter programming mode
Programming mode left
Connection to STK500 V2 closed

WARNING! One or more operations failed! Please examine the output log above!

 

Any suggestions as to what it might be?

 

Thanks in advance.

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

Shot in the dark: Since all three new STK500 boards are failing, could it be that they have firmware that is "too new" and incompatible with your stk500.exe software?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

I did upgrade the "NEW" ones with Atmel Studio 7. Is there a way to tell if the old and new match? I thought I upgraded the "OLD" one.

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

You can use Atmel Studio to inspect what of the firmware a tool has. I'm not on a Windoze system ATM so you'll have to locate it yourself. My guess would be somewhere around/in the Device Programming dialogue.

 

Since you have Atmel Studio 7 installed: Have you tried with the new(ish) command line tool "atprogram.exe" rather than the ancient "stk500.exe"?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

The STK500 firmware has not changed for about 10 years.

 

AS4 could detect the old firmware and prompt to Upgrade if required.

AS7 can not even detect the old firmware.   So it will not do any Upgrade.    (so I am sceptical about your AS7 upgrade)

 

I suggest that you run all your boards with AS4 and get them current.

 

AS7 will run fine with up to date (circa 2007) firmware.

 

I suspect that you are actually using "stk500.exe" from an old AS3 or AS4 Release.

Make sure that you have the "stk500.exe" from AS4.18 or AS4.19

 

David.

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

I will try these suggestions Monday when I return to work. Thank you.

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

Good afternoon everyone.

 

I do have STK500.exe. Now for the million dollar question, how do I upgrade in (or regrade) in AS4?

 

Thanks,

jw666

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

Hello everyone,

In AS4 I chose "Tools" and clicked on the first selection "AVR Prog..." and got the message shown below. This is with my working board.

 

 

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

You must put the STK500 into bootloader mode. e.g. hold the program button when you switch the power on.
.
But first off, you just need to read what firmware version you have. i.e. whether you need to update or not.
AS4 should do this automatically. But you can always read it for yourself from the programming window.
.
David.

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

David,

 

For the newer non-working STK500 I get this:

Detecting on 'Auto'...
STK500 with V2 firmware found on COM5:
Getting revisions.. HW: 0x02, SW Major: 0x02, SW Minor: 0x0a .. OK
Getting isp parameter.. SD=0x4c .. OK

 

The older "working" board  displays this:

 

Detecting on 'Auto'...
STK500 with V2 firmware found on COM5:
Getting revisions.. HW: 0x02, SW Major: 0x02, SW Minor: 0x0a .. OK
Getting isp parameter.. SD=0x02 .. OK

 

What is significantly different?

 

-jw666

 

 

 

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

You have correct firmware in both boards.  i.e. V2.2.0A

The SD=0x4C board,  the ISP frequency is 4.00kHz i.e. very SLOW.

The SD=0x02 board,  the ISP frequency is 115kHz i.e. fine for any 1MHz chips that are fresh from the factory.

 

If your 0x4C board is not working,   check all the jumpers.   Change the 6-way ribbon cable.

 

I presume you are programming external boards with either the 6-way ribbon or 10-way ribbon.

Note that the 6-way ribbon must be disconnected from any AVR mounted in the STK500 sockets when you are external programming.   i.e. unplug from SPROG1, SPROG2, SPROG3.

 

David.

 

p.s. my STK500.exe is from AS4.18.  Hence the copyright 2004-2011.   And it shows this from the command line:

C:\src\picoboot>"C:\Program Files (x86)\ATMEL\AVR Tools\STK500\Stk500.exe"  -J
STK500 command line programmer, v 2.4 Atmel Corp (C) 2004-2011.

Scanning ports:
COM1 ... Port busy or STK500 not connected
COM2 ... Port busy or STK500 not connected
COM3 ... Port busy or STK500 not connected
COM4 ... Connected to STK500 v2 on port COM4
Getting ISP frequency: 115.2 kHz (0x02)
Connection to STK500 v2 closed

If you explain what you actually want to do,  we can probably help you.

e.g. use stk500.exe from commandline (or .BAT file)

e.g. use AS4 GUI

e.g. use AS7 GUI

 

There are many ways to use a STK500 board.   Most third party Compilers, IDEs,  ... can control a STK500.   e.g. Codevision, Bascom, Imagecraft, ...

So it comes down to choosing the most "convenient" way to accomplish "what" you want.

Last Edited: Tue. Oct 24, 2017 - 10:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good morning David.

Thank you for your help thus far. I tried a lower clock frequency just to make sure. I had an entirely different application where the clock frequency was set too high. Just a wild guess on my part.

I have done all the checks you mention with no success.

We have a software system in place that uses batch files. Unfortunately it would require considerable work to change all the batch files.

I have three brand new STK500 boards that are not working while an older one is. Are any options available other than trying to return them?

 

-jw666

 

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

Any virgin 1MHz AVR will work with 115kHz.   There is no need to go any slower.

 

You could post a photo of the duff STK500 as connected to an external target.    You can conceal the identity of the target pcb with a strategic piece of paper.    But still show your ISP ribbon / pogo connections.

You will be amazed what a fresh pair of eyes will spot.

 

There is nothing complex about batch files.    Copy-paste in a PM if it is sensitive.

 

David.

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

at least in the old days (15+ years ago).

the SW for the stk500 had to sit on a com port known to the PC dos (can't be virtual), so I would try to force it to use one of the first 4 comports (those dos can see the old way form when they had a

IO addr. on the PC).

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

The STK500 does not need to use any particular COM port.

The "AVR prog" for the AS4 Upgrade does need to use COM1-COM4.

 

But since the firmware is up to date,  there is no need to do any Upgrade.

 

David.

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

-Hello,

 

Another message I got in AS7. It may be redundant but I am trying to track it down.

 

 

-jw666

 

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

How do power the AVR when you program?

 

If you power from stk500 then make sure that to vtarget is correct. (and I have had some sometimes forget).

 

And perhaps stupid but remove any AVR's on the board. (often they come with one plunged in)

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

Hey sparrow2,

That's been done. Thanks.laugh

 

-jw666

 

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

How do you power the AVR when you program?

and how do you power the stk 500?

 

I ask because the stk 500 can be powered with AC , so gnd on power is NOT gnd on STK500!

 

And I remember a long time ago powered a stk 500 with 12V from the PC it was connected to and it only worked with + and - one of the ways. 

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

sparrow2,

AC to 12 DC switching brick. Polarity is correct so that power switch works.

 

-jw666 

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

then

can you program a chip sitting in a socket?

 

 

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

sparrow2,

I will try that as soon as I can. Good suggestion.

 

-jw666

 

 

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

sparrow2,

Sorry to say neither STK500 worked on the socketed part.

 

-jw666

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

All-

 

Another curiosity I can use the non working STK500's on a Tiny26and program with the ISP6PIN connector. Yet they do not work on the MEGA168V.

 

-jw666

 

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

What is Vtarget in the two cases? 

I have at least one stk500 board the sometimes reset Vtaget (and it become 5V (or 5.1V)). Not a problem with a 5V device or even 3V if it's only the chip, but if you program a 3v3 board with something else it can be a problem.

 

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

Yes,  I would agree that STK500 is liable to reset VTarget to 5V occasionally.

 

I find it easier to power the external target from the STK500.  (Having set VTarget to 3.3V )

But the STK500 is quite happy with programming an externally powered target.

 

If you can program an external Tiny26 you can program ANY external AVR (that has a proper clock)

If the external target has no clock,  you can run a clock signal from the STK500 to XTAL1 on the external AVR.

 

It seems a bit of a mystery.   Your "new" STK500 boards should work perfectly.   

You can always duplicate each "test" on new and old STK500.

 

e.g. swap cables,  swap targets, ...

make notes with pencil and paper.

 

You can read voltages,   clock signals etc from one STK500 with the other STK500.

It is unlikely that two new STK500 would have the same fault.   (or any fault at all)

However,   humans and cables are subject to wear and tear.   I would check both thoroughly.

 

David.

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

ALL,

I will try these suggestions as soon as I can.

 

Thanks,

-jw666

 

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

All,

One thing that just occurred to me. How can I be sure the that the STK500 firmware supports an ATMEGA185V? If not, Could I copy the older firmware to the "newer" STK500 boards?

 

-jw666

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

Sorry. I meant ATMEGA168V.

 

-jw666

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

Th ATMEGA168V is just a lower voltage version of the old MEGA168 and have the same signature.

 

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

My failing STK500 board are supplying 5.00 volts DC + or - 1% 

 

-jw666

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

All,

Is the security bit mentioned below on the STK500 or on the ATMEGA168V?

 

 

 

-jw666

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

The ATMEGA168V can work from 1.8V - 5.5V, that error you are seeing comes up many time a month for various reasons. I don't know why.

 

Is the chip plugged into the correct socket? How about the 6 way programming ribbon? Is the clock running? Correct clock jumpers? Have you tried more than 1 chip?

 

Maybe you can post a photo of the STK500 with the chip mounted.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

If you are using an RS-232 to USB PC adapter (likely), I found some would just plain not work at all with the STK500, others would sporadically work & others were 100% fine...so try swapping that out, if applicable.

I had one that seemed fine for RS-232 work, but my STK500 did not like it, so I kept a label on it.

 

When in the dark remember-the future looks brighter than ever.

Last Edited: Sat. Nov 4, 2017 - 12:20 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All,

I am using the same 6 pin connector out of all STK500 Boards to DUT. I have used 5 different USB - RS232 adapters no difference. Attached is a photo of one of the nonworking STK500's.


 

 

-jw666

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

Can you read the ID of the chip ?

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

Before fiddling with your own cable...put a chip (or various flavors) into the stk500 & program the normal way, using the supplied cable & using studio 4...does THAT at least work.

 

or even better:

 

Plug in & program a chip in your working stk500 to use the internal 8Mhz RC clock & verify you can read its fuses in studio 4 (thus you can talk to the chip via stk500)...now move this chip into your bad stks ...can you still read the known  talking chip's fuses  (you know the chip clock is internal RC).

When in the dark remember-the future looks brighter than ever.

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

Good Morning, Resident and All,

I can not read signature with bad STK500. I can with the "OLDER GOOD" STK500 on Atmel Studio 4.17.   Same DUT on both STK500 boards.

 

-jw666

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

and you can read the id on the Tiny26 ?

 

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

Yes.

 

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

Does you board have it's own supply? If so you MUST remove the VTARGET jumper on the STK500 or the 2 supplies are likely to conflict with each other.
 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js,

 

Good point. But in this case the target does not have it's own supply.

 

-jw666

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

I would start by doing what avrcandies says in post #37, if it doesn't work you may have just killed the STK500, maybe with wrong ISP header connections at some stage.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

 I have used 5 different USB - RS232 adapters no difference

were they actually different (not same brand/model...I had some that for whatever reasonall worked fine for  rs232 uae but not all worked on the stk...maybe due to latency or othere minor rs232 differences (such as handshaking) 

When in the dark remember-the future looks brighter than ever.

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

since it can programme a tiny26, I must assume that the UART is ok (as before only error I can see there is if there is Gnd problem).

 

so the next you can't programme a 168 dip version (in the socket), which clk does that chip have programmed, (perhaps programme it to 1MHz internal clk with the good board, and then try again)

 

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

sounds like the serial comm  to PC is working (now I see you can prog tiny26), so prob not your usb adapter

 

 Here's an idea:

Does your circuit board share MOSI, MISO, SCK or reset with other chips or circuits (or have pulldowns, caps, etc on the lines?)   It could be the working stk is just barely able to program it, but maybe the new stk's can't quite handle the extra loads.

 

***ALSO...set your ISP programmer clock to the bare minimum (this is NOT the processor clock)...this is a saved studio setting, if I remember....we had an issue with a "long" isp programming cable (about 18 inches)...wouldn't program...turning down the speed  & it worked fine.  In studio4 , it is easy to adjust this (main tab, ISP frequency)...never have found the isp speed adjustment in studio 7

 

 

When in the dark remember-the future looks brighter than ever.

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

All,

Please forgive my ignorance

This is the command line I am using. neither 250kHz or 100kHz works.


T:\DATA>stk500 -dATmega168 -s -l250kHz
STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.

Scanning ports:
COM1 ... Port busy or STK500 not connected
COM2 ... Port busy or STK500 not connected
COM3 ... Port busy or STK500 not connected
COM4 ... Port busy or STK500 not connected
COM5 ... Connected to STK500 V2 on port COM5
Device parameters loaded
Could not enter programming mode
Programming mode left
Connection to STK500 V2 closed

WARNING! One or more operations failed! Please examine the output log above!


T:\DATA>stk500 -dATmega168 -s -l100kHz
STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.

Scanning ports:
COM1 ... Port busy or STK500 not connected
COM2 ... Port busy or STK500 not connected
COM3 ... Port busy or STK500 not connected
COM4 ... Port busy or STK500 not connected
COM5 ... Connected to STK500 V2 on port COM5
Device parameters loaded
Could not enter programming mode
Programming mode left
Connection to STK500 V2 closed

WARNING! One or more operations failed! Please examine the output log above!





 

---WORKING STK500----

 

T:\DATA>stk500 -dATmega168 -s -l100kHz
STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.

Scanning ports:
COM1 ... Port busy or STK500 not connected
COM2 ... Port busy or STK500 not connected
COM3 ... Port busy or STK500 not connected
COM4 ... Port busy or STK500 not connected
COM5 ... Connected to STK500 V2 on port COM5
Device parameters loaded
Programming mode entered
Signature is 0x1E 0x94 0x06
Programming lock bits (0x00)... Lock bits programmed
Programming mode left
Connection to STK500 V2 closed

T:\DATA>stk500 -dATmega168 -s -l250kHz
STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.

Scanning ports:
COM1 ... Port busy or STK500 not connected
COM2 ... Port busy or STK500 not connected
COM3 ... Port busy or STK500 not connected
COM4 ... Port busy or STK500 not connected
COM5 ... Connected to STK500 V2 on port COM5
Device parameters loaded
Programming mode entered
Signature is 0x1E 0x94 0x06
Programming lock bits (0x50)... Lock bits programmed
Programming mode left
Connection to STK500 V2 closed


 

Is this what was basically asked of me to do?

 

 

-jw666

 

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

Is there some reason you are not specifying the COM port you know for the USB-RS232 that is connected to the CTRL of STK500? Different USB-RS232 have the habit of being assigned different COM port numbers.

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

It depends on the USB-RS232 driver.    FTDI chips allocate a COM# to a particular cable.

CH340 chips just assign a COM# to the particular USB socket.

 

It should be pretty straightforward to run a series of tests on each STK500.

e.g.

1. program Blinky on Tiny26 with internal RC fuses via good STK500.

2. put Tiny26 onto bad STK500.  Does Blinky blink?

3. program Blinky on Tiny26 with external clock fuses via good STK500.

4. change STK500 clock.   Observe blink rate.

5. put Tiny26 onto bad STK500.  Does Blinky blink?

6. change STK500 clock.   Observe blink rate.

 

This will verify STK500 VCC and clock system.

 

7. try to read Signature on bad STK500.

8. try to program different Blinky on bad STK500

 

It is easy enough to devise a numbered test sequence and write the numbered result on paper.

 

You will probably discover what or where the problems are.    If not,   you can post your detailed report here.

 

Quite honestly the STK500 is very robust.   You can check VCC, Clock, ISP, ... methodically.

 

Regarding the OP's commandline.   My stk500.exe is a later version.  e.g.

C:\>"C:\Program Files (x86)\ATMEL\AVR Tools\STK500\Stk500.exe"  -dATmega32 -s -I100kHz
STK500 command line programmer, v 2.4 Atmel Corp (C) 2004-2011.

Scanning ports:
COM1 ... Port busy or STK500 not connected
COM2 ... Port busy or STK500 not connected
COM3 ... Port busy or STK500 not connected
COM4 ... Connected to STK500 v2 on port COM4
Setting ISP frequency to 57.60 kHz (0x03)
Device parameters loaded
Programming mode entered
Signature is 0x1E 0x95 0x11
Programming mode left
Connection to STK500 v2 closed

I would be wary of a (c) 2005 version of stk500.exe

 

David.

Last Edited: Tue. Nov 7, 2017 - 02:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have never used stk500 with other than studio4 

I would suggest that you download studio 4.18 , and get your stk500 connected, and then do the settings and checks like as in the manual for the stk500 (id read, programming clk speed, Vcc and Avcc settings etc.)  

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

Is this what was basically asked of me to do?

If this test was with a chip mounted on the STK500 itself then yes.

I can with the "OLDER GOOD" STK500 on Atmel Studio 4.17

Then if you have Studio why are you using command line? Using Studio may give you other information about the STK500 particularly on the Hardware tab.

(edited screen shots)

 

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Tue. Nov 7, 2017 - 08:37 PM

Pages