Connection problem after changing clock speed

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

I was using an ATmega32 with an external oscilator 16MHz and i wanted to reduce the clock speed to 8MHz.I changed it to 8MHz then pressed 'Program' (in AVRStudio 4.19) but i forgot to take off the external oscilator.After i did that i couldn't connect to the microcontroller with the JTAG with an error "The OCD JTAG adapter was detected,but the target device did not return a valid JTAG ID".I didn't change anything in the connections. Anyone knows how to make it work again?

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

How did you "change" the frequency to 8MHz?

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

From the connection panel in the "Fuses" page i changed it to "Int. RC Osc. 8MHz;Start-up Time:6CK +64 ms" (i had it in "Ext.Osc...")  and then pressed "Program" button

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

When using ISP, the clk must be set 1/4 the cpu speed, I forget if JTAG is similar.   If you can, slow down your jtag speed.

 

Jim

 

 

FF = PI > S.E.T

 

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

I don't think that's the problem because when i was using it in 16MHz everything was good...also i don't know how to slow down JTAGs speed :)

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

wolky wrote:
I don't think that's the problem because when i was using it in 16MHz everything was good

You're missing ki0kb's point. For at least some programming methods the speed at which programming data is clocked into the AVR (the programming requency) has to be below 1/4th of the CPU clock of the AVR. 

 

Let's assume, for the sake of an example, that the programming frequency was (and is) 3 MHz. With a CPU clock frequency of 16 MHz you were well within margins. 3MHz < 16/4 MHz.

 

Now your AVR is possibly running at 8 MHz, and 8/4 = 2 MHZ and the programming frequency has to be lower than that.

 

I don't have any JTAG tool handy so I'm not sure if and how you can change the programming frequency. I'll take a look in the box in the basement and see if I can fins one.

 

Meanwhile, you could take a look in the project properties, Select the Tool section, make sure your JTAG is attached and selected. Do you see any dialogue element that has to do with programming frequency?

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. May 13, 2017 - 07:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not done yet? You're too slow... ;-)

 

Look-a-here:

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

Thank you for the explanation there i think i got the point now:)...i tried to change the frequency of JTAG more than once. In AvrStudio i pressed Tools -> AVRprog -> Advanced (as shown in the picture).I tried different frequencies hopping for one to work but the result is the same

Attachment(s): 

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

No, that is not a dialogue to change the programming frequency  (the frequency with which the programming hardware operates).

 

Your screenshot show a dialogue to set the fuses of the AVR itself. 

 

Before you run away and create more of a mess, answer these questions:

 

- What JTAG Tool are you using? MAker and model/name, please.

 

- What version of AVR/Atmel Studio are you using?

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: Sun. May 14, 2017 - 02:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ohh so i was making the situation worse...I am using AVR JTAG ICE version 2.0 (clone) and AvrStudio 4.19. Although the AvrProg is surely for the JTAG im not sure about the 'Advanced' option in the "Device" panel as you are saying 

Last Edited: Sun. May 14, 2017 - 03:05 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, 4.19. I'm afraid I can't be of much use then. Haven't had that installed for a long time.

 

There are some users around here that still run 4.*, so someone might be able to help you with how you trim the programming frequency.

 

Clone JTAGs have never been very popular around here. If AVRs are to be a long-time hobby or occupation you might consider modernizing your box'o'toys: The Atmel ICE is about $50 (plus s/h)..

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

If the problem is the programming frequency i think i will find it. Although in the past i was changing the ATmega32's frequency (4,8,16 MHz) without doing anything in the JTAG's frequency and everything were running ok

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

There is the possibility that you actually chose a bad set of fuse values and programmed it to the AVR. One example, not necessarily what you did but only an example, is to select external clock without this actually being present.

 

The remedy to such a situation depends on what fuses where actually set, and since one does not know for certain what these where its a bit of a trial-and-possible-success. The dead-certain method is to get a hold of a programmer being able to do parallel programming, wire that up and reset the fuses to a known and good state. Which ones, you ask? Off the top of my head: STK500, STK600, AVR Dragon.

 

Not saying that is what has happened, just saying that it is possible.

 

Go over to the Tutorials subforum and search out the (langthy) thread on resurrecting a bricked AVR. "Resurrecting" and "bricked" are good words to use for the search.

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

Did you use JTAG when you first saw the problem or were you using ISP? If the later then you could have turned off the JTAG fuse.

 

JTAG does not need a running clock to work as it has it's own clock.

 

Of course we have no idea about your board or whether is is wired up correctly to start with, if not wired correctly you could have damaged the chip.

 

By the way you DON'T WANT "AVRprog" but "Program AVR" about 2/3 down the Tools screen.

 

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I didn't change anything in the 'Fuses' page except the frequency.I don't know if they change on their own (if this is possible).Maybe the problem occured because i forgot to disconnect the external oscilator and programed my device to run with the internal oscilator.

If some Fuses have changed then i will try to do parallel programming with an ISP.AS for the tools, i'll stick with the clones for now :)

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

I am using only a JTAG (since i don't have an ISP yet).I didn't touch the JTAGEN fuse but i'm not sure if it changed by itself (as i said above).I also didn't change the connections (of the JTAG)

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

wolky wrote:
If some Fuses have changed then i will try to do parallel programming with an ISP
 

 

An "ISP" does not do parallell programming. The "S" in there stands for "serial".

 

 

Also, note that I am in no way sure that the situation craves parallell programming. S geting hold on something that can do parallel programming might be overkill. Also be aware that parallel programmig requires a lot of wiring. 8 data lines, 8 control lines, 12 volts on the RESET pin and a clock signal on XTAL1. The STK500, STK600 and AVR Dragon will produce this (and an ISP, which has 10 pins at most, will not). See the chapter "Memory Programming" in the data sheet for more. E.g. Figure 127 for parallel programming. Compare that with Figure 136 for SPI (a.k.a "ISP") programming.

 

Seek other solutions before exploring parallel programming (unless you have all required pins readily available and not wired so that they will disturb the programming, and can get a parallel-programming-capable tool on loan or similar).

 

And no, fuses will not change themselves.

 

OTOH, many of us have accidentally misprogrammed fuses without any intention to do so ;-)

 

Again, I'm not saying that bad fuse values is your problem. I know nothing about your actual programmer. E.g. it could be that this clone has no provisions to lower the programming frequency the way an original Atmel JTAG dongle can.

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: Mon. May 15, 2017 - 06:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using only a JTAG

Interesting because you also say

Although the AvrProg is surely for the JTAG

and that's definitively wrong as it only supports ISP with old AVR910 type programmers and NOT JTAG.

 

Post a screen shot of what you are really using with your programmer.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I thought SPI(Serial Peripheral Programming) and ISP(In System Programming) were different:)...Maybe if i change the fuses to default value (if that's possible) will solve this.

I had the same connection error before (with another microcontroller) but i was playing a little with the fuses in that one :).So i bought a new (this one) and i didn't have a problem until now :/

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

I'm not sure what you are saying here...i have upgraded the firmware of JTAG once because i had some connection issues and after that i didn't have them (the upgrade.ebn as shown in the picture above) from the AvrProg so i guess it is indeed for the JTAG

That's the programmer that i use (JTAG clone)

Attachment(s): 

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

You keep on talking about AVRprog, this is what the screens for it looks like.

 

 

This does NOT support JTAG, for JTAG you need to use Program AVR and it looks like this.

 

 

 

so which one are you using?

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Oh yes when i want to connect i use Program AVR->Connect->JTAG ICE...In the AvrProg i was trying to change the frequency of JTAG but that was wrong as is seems :)